Report: Change forecolor based on a condition

C

Color

how do i change the forecolor on a report
based on a certain condition. i've tried
the following but access2000 has no .forecolor.

please help.

Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)
const Red = 255
const Black = 0
me.text1.forecolor = iif([text1]="X",Red,Black)
End Sub
 
F

fredg

Color said:
how do i change the forecolor on a report
based on a certain condition. i've tried
the following but access2000 has no .forecolor.

please help.

Private Sub Detail_Print(Cancel As Integer, PrintCount As
Integer)
const Red = 255
const Black = 0
me.text1.forecolor = iif([text1]="X",Red,Black)
End Sub

re: > but access2000 has no .forecolor <
Oh really!!!!

In Access 2000 you could use the control's Conditonal Formatting
property, but if you wish to do this in a Report event, you would use
the Detail Format event:

If [Text1] = "X" Then
[Text1].ForeColor = vbRed
Else
[Text1].ForeColor = vbBlack
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top