Form text box colour to vary by record

303factory

Registered User.
Local time
Today, 21:03
Joined
Oct 10, 2008
Messages
136
Hi. Not sure if this is possible:

I have a subform linked to a table. It will either be continuous forms or datasheet view, so there can be any number of records.

I would like the background colour of some of the text boxes to vary dependent on booleans on the table.

For example if a record in the table has 'True' in the field 'NameError' I need the text box for 'Name' to have a red background colour. Otherswise I need it to be green.

I've tried changing the background colour of the text box with the 'name' control source. However it seems the colour of the text box is linked for all records on the subform, if I change just one they all go red.

Is what I want possible?
 
Use Conditional Formatting (in versions prior to 2007 it is at FORMAT > CONDITIONAL FORMATTING after selecting the text box in question).

So, for the conditional formatting select the name box (NAME is not a good name to use for any objects as that is an Access Reserved Word and this one especially can cause you major grief by doing so, so I would suggest going back and renaming it and changing wherever you used it). Then change the VALUE IS to EXPRESSION IS and put:

[NameError]=True

and select the color from the list for the fill.
 
Use Conditional Formatting (in versions prior to 2007 it is at FORMAT > CONDITIONAL FORMATTING after selecting the text box in question).

So, for the conditional formatting select the name box (NAME is not a good name to use for any objects as that is an Access Reserved Word and this one especially can cause you major grief by doing so, so I would suggest going back and renaming it and changing wherever you used it). Then change the VALUE IS to EXPRESSION IS and put:

[NameError]=True

and select the color from the list for the fill.

perfect thanks! and thanks for the advice regarding the name field
 
Use Conditional Formatting (in versions prior to 2007 it is at FORMAT > CONDITIONAL FORMATTING after selecting the text box in question).

So, for the conditional formatting select the name box (NAME is not a good name to use for any objects as that is an Access Reserved Word and this one especially can cause you major grief by doing so, so I would suggest going back and renaming it and changing wherever you used it). Then change the VALUE IS to EXPRESSION IS and put:

[NameError]=True

and select the color from the list for the fill.

Is it possible to do something similar with tickboxes? neither the tickbox or it's label allows me to do conditional formatting. I could have a flat text box instead of a label I suppose but if there's another way...
 
Doesn't work with labels. Use a text box formatted to look like a label.
 

Users who are viewing this thread

Back
Top Bottom