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

Change a field color when certain conditions are met

Status
Not open for further replies.

longbillduck

Technical User
Sep 26, 2001
29
US
I'm trying to figure a way to change a field color say from white to red when a box is checked.

I'm seem to remeber seeing this somewhere, but can't find it now

Any help would be appriciated

Art
 
In the after update event code for your form do something like this:

If condition Then
YourControlName.BackColor = vbRed
End If

Reset everything in the On Current form code like this:

YourControlName.BackColor = vbWhite

Good Luck!

Please remember to give helpful posts the stars they deserve! This makes the post more visible to others in need![thumbsup]
 
Dear Art,
See the following code which is on a form: frmJobsBack and refers to a control AcctStatus and if the value of that control is Check then it changes the color of the background Red (255) if it is not equal to Check (i.e. <>) then it leaves it white (16777215)

Code:
 If Me.AcctStatus.value = &quot;Check!&quot; Then
    Me.AcctStatus.BackColor = 255
    ElseIf Me.AcctStatus.value <> &quot;Check&quot; Then
    Me.AcctStatus.BackColor = 16777215

The numbers are colors which you can work out from the properties sheet for any of your Txt Boxes by changing the background color and checking the number that comes up in the field for background color. Regards Jim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top