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

How can I Change the text color and background colour of a field when

Status
Not open for further replies.

sccice

Programmer
Apr 5, 2001
4
GB
I have a button that updates certain fields within a form and i would like to alter the background color and text color of fields if it updates them
 
In the On_Current Event of the form enter:

Private Sub Form_Current()
If (Me!txtBox1) <= Me!txtBox2 Then
Me!txtBox2.ForeColor = 255
Me!Label1.Visible = True
Else
Me!txtBox2.ForeColor = 0

Me!Label1.Visible = False
End If

End Sub

This will also display a label (which you could hide as not visible) upon the criteria being met.

Set the button to:

Private Sub Button1_AfterUpdate()

' Run Form_Current procedure.
Form_Current

End Sub

hope this helps!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top