PDA

View Full Version : Conditional Formatting row using Checkbox



oam
07-18-2016, 07:33 PM
I am brand new to Access; I worked a lot Excel for years using formulas and macros but I need help with Access!

I have a row of text fields that I need to change color when a checkbox is checked and clear when the check is removed.

Can anyone help me on this and thank you for your time?

jonh
07-18-2016, 11:40 PM
What do you mean by change colour?
Does the form show a single record or is it continuous?

You can't change the back colour of a text box for one record only on a continuous form.
You can change the font colour using conditional formatting, but afaik that only works for numbers.

Otherwise you just need to code up the click event of the checkbox. Something like


if chkbox1 then
txt1.backcolor = vbblue
txt2.backcolor = vbred
txt3.backcolor = vbyellow
else
txt1.backcolor = vbwhite
txt2.backcolor = vbwhite
txt3.backcolor = vbwhite
end if


Or if the value of the checkbox is stored, use the oncurrent event so it changes when you move between records.

oam
07-19-2016, 05:37 PM
When the checkbox is checked textboxes 131:164 background color changes to dark gray and when the check is removed the boxes return to No background color.
16676