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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text color change

Status
Not open for further replies.

scra

Technical User
Dec 7, 2001
55
US
Hi, in Access97 report, I would like a text color change other than black (i.e. red, blue or green) when a value is greater than 5.00.

Thanks....scra
 
I haven't tried this before, but I understand that you can use the report detail OnFormat event procedure to check the value, then set the text color.

Hope this helps,

Peter De Baets
Peter's Software - MS Access Tools for Developers
 
In the detail section OnFormat event use this code:
[tt]
If MyValue > 5 Then
MyTextBox.ForeColor = vbRed
Else
MyTextBox.ForeColor = vbBlack
End If
[/tt]

HTH Joe Miller
joe.miller@flotech.net
 
Joe, I have placed the code as....and a compile error "Method or data member not found". Please advice.

Dim MyValue As String
Dim MyTextbox As Recordset

If MyValue > 4.46 Then
MyTextbox.ForeColor = vbRed
Else
MyTextbox.ForeColor = vbBlack
End If

End Sub
 
You do not need the DIM statements for this code. MyValue was meant to be the value you are inspecting (IE: a textbox with a numeric value). MyTextBox was meant to be the name of the textbox on your report that you want to change the color of.

Joe Miller
joe.miller@flotech.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top