How to change the color of a field?

aziz rasul

Active member
Local time
Today, 21:19
Joined
Jun 26, 2000
Messages
1,935
I have a report which includes the field Male/Female. This field takes on one of two values i.e. F or M.

In the report I have grouped data based on the value of this field.

How do I change the color of the Male/Female field to say red when it equals F and change it to a different color when it equals M?
 
I did something similar to this in a database I have...

Here is the code with an explanation following:

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Select Case Security_Status ' Evaluate the Security_Status field
Case "Priority 1" ' Priority 1 locations
Me!ext_Site.BackColor = 12632256 ' Leave the shading White
Case "Priority 2" ' Priority 2 locations
Me!ext_Site.BackColor = 16777215 ' Change the shading to Grey
End Select
End Sub

You have to run this in the detail so it executes for every record on the report.

Basically whay MINE does, is...
As each record is dropped onto the report, access checks the Security_Status and if the field contains the text "Priority 1" or "Priority 2" it shades the Site number. on the report. Now I had to set the ext_Site field on the report to BackStyle = Normal, but I did that through the properties of the field in the reports Design view. Having it as Transparent will mean you don't see any shading. So make sure you set that right.

Hopefully, this helps. Any questions, just let me know.
 
Many Thanks for that.
 

Users who are viewing this thread

Back
Top Bottom