Hi all I have a few fields in my form which are customers personal details (Title, Name, Date of birth etc) I also have a checkbox (Insured) I would like to make all fields (except checkbox) green if the checkbox is ticked. Can anyone help please?
Hi all I have a few fields in my form which are customers personal details (Title, Name, Date of birth etc) I also have a checkbox (Insured) I would like to make all fields (except checkbox) green if the checkbox is ticked. Can anyone help please?
In the AfterUpdate Event of the checkbox(Change field names to yours):
If me.checkbox = True thenme.Field1.backcolor = vbGreenElseme.Field1.backcolor = vbWhiteEnd If
Also add the code to the OnCurrent event so as you get to a new record if it is checked, it will display them as green.
in design view, select all the controls (not fields) you want to be green if insured is true (ticked)
on the ribbon, select conditional formatting on the format tab. Select new rule then 'check values in the current record....'
In the format only cells section, select Expression is from the dropdown.
Then in the expression part put
[Insured]=true
and in the preview section select the formatting required
click OK
note that [Insured] is the name of your checkbox and needs to be bound to a field in your recordsource. If it is unbound, then it will have the same value in all the records, so all controls will display accordingly
Thank you so much. I tried Ajax answer as I am just a novice and it seemed easier. Works brilliantly thanks again