Changing color (background & foreground)

  • Thread starter Thread starter Allan Murphy
  • Start date Start date
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
 
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!
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top