Is there a way to colour a forms controls based upon another control?
I have a control name MonTechID.
Where this is non zero i wish to colour this control and 2 other controls to be a shade of green.
Setting a colour on a control based upon another control
-
- 5StarLounger
- Posts: 1148
- Joined: 08 Feb 2010, 21:27
-
- Administrator
- Posts: 78625
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Setting a colour on a control based upon another control
Open the form in design view.
Select the controls that you want to colour.
Select Format | Conditional Formatting (Access 2003 or earlier) or Design tab > Conditional (Access 2007).
Select "Expression Is" from the dropdown under Condition 1.
Enter the following expression in the box next to it:
[MonTechID]<>0
Use the format buttons to specify the desired text colour, background colour etc.
Click OK.
Select the controls that you want to colour.
Select Format | Conditional Formatting (Access 2003 or earlier) or Design tab > Conditional (Access 2007).
Select "Expression Is" from the dropdown under Condition 1.
Enter the following expression in the box next to it:
[MonTechID]<>0
Use the format buttons to specify the desired text colour, background colour etc.
Click OK.
Best wishes,
Hans
Hans
-
- 5StarLounger
- Posts: 1148
- Joined: 08 Feb 2010, 21:27
Re: Setting a colour on a control based upon another control
I was almost there but missed the significance of the "expression is".
Thank you Hans, I'll stop wasting your time.
Thank you Hans, I'll stop wasting your time.
-
- 2StarLounger
- Posts: 164
- Joined: 10 Feb 2010, 12:53
Re: Setting a colour on a control based upon another control
A question based on this: I have a sub-form in a tab on a form, is it possible to cover it up or "grey it out" by using conditional formatting please? I gave tried to do this but the conditional formatting option is greyed out...
-
- Administrator
- Posts: 78625
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Setting a colour on a control based upon another control
Conditional formatting only applies to text boxes and combo boxes, not to subforms.
You can use VBA code to hide/unhide the subform depending on a condition.
It is also possible to hide/unhide or to disable/enable the tab page containing the subform.
You would typically do this in two places:
- In the After Update event of the control whose value determines whether you want to show the subform, and
- In the On Current event of the main form, for when the user moves from record to record.
You can use VBA code to hide/unhide the subform depending on a condition.
It is also possible to hide/unhide or to disable/enable the tab page containing the subform.
You would typically do this in two places:
- In the After Update event of the control whose value determines whether you want to show the subform, and
- In the On Current event of the main form, for when the user moves from record to record.
Best wishes,
Hans
Hans