Forecolor of a Field in a Report

GMSRE

Registered User.
Local time
Today, 06:33
Joined
Apr 27, 2011
Messages
29
Hello,

I am trying to change the color of the CDHardCopyFiled field in a report turn red, when the value in the field is “No”. The No responses in the report do not turn red for the CDHardCopyFiled field. Here is the code I used.
Private Sub Report_Load()
If CDHardCopyFiled = "No" Then
Me!CDHardCopyFiled.ForeColor = vbRed
End If
End Sub

Please help. Thank you.

GMSRE
 
Re: Forecolor of a Field in a Reprot

The best tool for the job is Conditional Formatting. If you want to do it in code, you'd use the detail format event, and you'd need to have an Else to handle the other option.
 
Re: Forecolor of a Field in a Reprot

Hi Paul,

Would you mind giving me an example code or conditional formatting? I was not able to find what I was looking for conditional formatting.

Thanks.
 
Re: Forecolor of a Field in a Reprot

Prior to 2007, highlight the textbox then Format/Conditional Formatting. 2007 & 2010, it's on the ribbon.
 
Re: Forecolor of a Field in a Reprot

Hi Paul,

It works. Fantastic. Thanks so much for your help.

GMSRE
 
Re: Forecolor of a Field in a Reprot

Excellent, glad it worked for you.
 

Users who are viewing this thread

Back
Top Bottom