By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,472 Members | 1,219 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,472 IT Pros & Developers. It's quick & easy.

Highlight the background color of data on conditions

P: n/a
Ray
I use following event procedure in report but the background colors have no
effect at all but other two formats are ok. Can someone point me out where
I may make a mistake. I am using Access 97.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If Me.[1] >= 65 Then
Me![1].BackColor = vbGreen
Me![1].ForeColor = vbBlack
Me![1].FontBold = True
ElseIf Me.[1] >= 50 And Me.[1] <= 64 Then
Me![1].BackColor = vbYellow
Me![1].ForeColor = vbBlack
Me![1].FontBold = True

ElseIf Me.[1] >= 0 And Me.[1] <= 49 Then
Me![1].BackColor = vbRed
Me![1].ForeColor = vbBlack
Me![1].FontBold = True

End If

End Sub

Thanks,

Ray
Nov 13 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 14 Jul 2004 11:21:51 -0700, Ray wrote:
I use following event procedure in report but the background colors have no
effect at all but other two formats are ok. Can someone point me out where
I may make a mistake. I am using Access 97.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If Me.[1] >= 65 Then
Me![1].BackColor = vbGreen
Me![1].ForeColor = vbBlack
Me![1].FontBold = True

ElseIf Me.[1] >= 50 And Me.[1] <= 64 Then
Me![1].BackColor = vbYellow
Me![1].ForeColor = vbBlack
Me![1].FontBold = True

ElseIf Me.[1] >= 0 And Me.[1] <= 49 Then
Me![1].BackColor = vbRed
Me![1].ForeColor = vbBlack
Me![1].FontBold = True

End If

End Sub

Thanks,

Ray


1) Use the Detail format event.

2) Make sure the BackStyle property of the control is set to Normal,
not Transparent.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
Nov 13 '05 #2

P: n/a
Ray
Fred,

Thanks for your advice.

Could you please explain in detail why not Detail Print. You second
suggestion works well.

Ray

fredg <fg******@example.invalid> wrote in message news:<ez*****************************@40tude.net>. ..
On 14 Jul 2004 11:21:51 -0700, Ray wrote:
I use following event procedure in report but the background colors have no
effect at all but other two formats are ok. Can someone point me out where
I may make a mistake. I am using Access 97.

Private Sub Detail_Print(Cancel As Integer, PrintCount As Integer)

If Me.[1] >= 65 Then
Me![1].BackColor = vbGreen
Me![1].ForeColor = vbBlack
Me![1].FontBold = True

ElseIf Me.[1] >= 50 And Me.[1] <= 64 Then
Me![1].BackColor = vbYellow
Me![1].ForeColor = vbBlack
Me![1].FontBold = True

ElseIf Me.[1] >= 0 And Me.[1] <= 49 Then
Me![1].BackColor = vbRed
Me![1].ForeColor = vbBlack
Me![1].FontBold = True

End If

End Sub

Thanks,

Ray


1) Use the Detail format event.

2) Make sure the BackStyle property of the control is set to Normal,
not Transparent.

Nov 13 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.