Changing color (background & foreground)

A

Allan Murphy

In the On Format event of the Detail section of the report enter the
following code

if me!control_name = my_value then
me!control_name.backcolor = the colour value
me!control_name.fore = the colour value
else
me!control_name.backcolor = the default colour value
me!control_name.fore = the default colour value
end if

You need the else statement to reset the control_name fore and back colours
otherwise you will end up with the incorrect colours for a control
that does not meet your criteria.

Allan
 
J

Jim

Looking for help with a color setting on a report.

I'm designing a report in which the background & foreground colors for a
single control need to change based on a database / query produced value.

Each record in the query contains the background & foreground numbers that I
want a specific control to use when printed. For example, green = 44544.

How can I get ACCESS to change these attributes dynamically?

My database is running in Access 2000.

Thanks in advance for any help. I had it figured out approx 2 years ago,
and forgot how I did it! This "getting old thing" is for the birds!
 
P

Pieter Wijnen

In The Detail Format Event
Private Sub Detail_Format(fc As Integer, cancel As Integer)
Me.Ctl1.BackColor = Me.Ctl2.Value
' Me.Ctl1.ForeColor = Me.Ctl2.Value
End Sub

HTH

Pieter
 
Top