If you have a field [strStatus] in a table which can have values of "On" or "Off", and you want "Off" records to appear in [color red]Red[/color] text and "On" records to have [color green]Green[/color] text, this is the FAQ for you.
Unfortunately, these values cannot be edited.
Make several copies of the field you want coloured, give them all the same size and position. Give them sensible names, like txtStatusOn, txtStatusOff. Make each one transparent, with a foreground colour set to the colour you want. You might want to make the fields disabled and locked.
In each controls Control Source put:
Code:
=IIf([strStatus]="On",[strStatus],"")
for the [color green]Green[/color] one, and
Code:
=IIf([strStatus]<>"On",[strStatus],"")
for the [color red]Red[/color] one.
These field will be empty unless the IIf expression is True, in which case it would appear as the text in the required colour.
Now open the form. All Status fields with a status of On will be in [color green]Green[/color] text, and all others will be in [color red]Red[/color].
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.