Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bold and change colour of a value if negative

Status
Not open for further replies.

Jacqui3

MIS
May 8, 2002
13
0
0
ZA
Hi,

I have created a variance report (the variance is calculated in the query upon which the report is based).

What I would like to do is - if the variance calculated is negative I would like to make the variance value red and bold.




 
Assuming that the field is called Variance, then add the following code to the OnFormat event of the Details section (assuming that the field is in this section)

Dim R As Report: Set R = Me
If R!Variance < 0 Then
R!Variance.FontBold = True 'bold
R!Variance.ForeColor = 255 'red
Else
R!Variance.FontBold = False 'not bold
R!Variance.ForeColor = 0 'black
End If

Hope that this helps,
Cheers,
Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top