Access 97-change colour of a number in a report depending on value?

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hi,
I'm using access 97 and have a basic report lising a
series of results for a number of sites. I'm wanting to
change the appearence of a number depending on what it
is...say if it's > than 2000, the result is shown in red
and if below 100 in green. I understand conditional
formating is only available in access 2K but wanted to
know if there's a way? Even having a text box behind the
number and changing the colour of that would help!!
 
Peter:

Actually this is pretty easy to do. In the On Print event of the section of
the report that contains the control with the value you want to evaluate and
change the colour of, add code like this:

Const RED = 255
Const GREEN = 65280

If Me!NameOfYourControl.Value > 2000 Then
Me!NameOfYourControl.ForeColor = RED
Else
Me!NameOfYourControl.ForeColor = GREEN
End If

HTH
 
Back
Top