Report: Change forecolor based on a condition

  • Thread starter Thread starter Color
  • Start date Start date
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
 
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
 
Back
Top