Conditional formatting

bpalesch

Registered User.
Local time
Yesterday, 19:42
Joined
Sep 13, 2002
Messages
29
Is there a way to conditionally format text on an Access report? For example, if a number is positive have it appear in black on the report and if it is negative appear in Red? I can't find anything about using text attributes in an IIf statement.

Thanks,
bpalesch
 
In the OnFormat event of the Detail section use this code:

{Using txtNumber as the name of the textbox}

If Me.txtNumber < 0 Then
Me.txtNumber.ForeColor = vbRed
else
Me.txtNumber.ForeColor=vbBlack
End if


HTH
 
Conditional Formatting

Harry,

Thanks - it works fine. Really appreciate it.

bpalesch
 
In Access 2000 this can be done without VB - there is a conditional formatting option in the menus the same as Excel
 
Richio said:
In Access 2000 this can be done without VB - there is a conditional formatting option in the menus the same as Excel


THANK YOU THANK YOU THANK YOU

I searched this and other forums trying to find this answer. All of the replies were with VB code or some fancy way to do it. That worked perfectly and was easy for us newb's. Thanks! :D
 

Users who are viewing this thread

Back
Top Bottom