Changing colors in a field automatically

padlock

Registered User.
Local time
Today, 07:01
Joined
Mar 11, 2005
Messages
10
Hi everyone,

The problem I'm having is I need to have the background of a field change color depending on what's contained within the field. There's only three possible entries in the field: active, inactive, and a blank entry. I need it to show green if the field contains "active", red if the field is "inactive" or is blank (I also want the blank fields to show inactive, but that's niether here or there right now.)

I've been trying to get it to work with an if then statement, and setoption to change the background. I've had no luck with any of it, though.

Any help would be greatly appreciated. Thanks in advance.

-Walter
 
Paste the code OnCurrent in form.

If IsNull([FieldName]) Or ([FieldName]) = "Inactive" Then
FieldName.BackColor = vbRed

Else
FieldName.BackColor = vbGreen
End If


hth,
Michael
 
Thank you!

Thanks for the help! It worked perfectly, and I also figured out my other problem with having blank fields shows Inactive using the following:

If IsNull([Active Inactive]) Then
[Active Inactive] = "Inactive"

Thanks again for the help, that was a life saver! I'm getting a hang of it, just was dropped into working on all this out of no where (I'm a server admin, heh.) Thanks!

-Walter
 
No problem glad I can help. ;) Sorry I forgot about making a blank field show inactive. :eek:

Michael
 

Users who are viewing this thread

Back
Top Bottom