Conditionally Formatting a checkbox

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

On a continuous form I need to enable or disable a checkbox based on the
value in another field.

Conditional Formatting is not available for checkboxes. Has anybody ever
done this some other way?
 
You could try this somewhat convoluted workaround.

Replace the check box with a text box, and give it these properties:
Control Source {the name of your yes/no field goes here}
Font Name Wingdings
Format \û;\ü
The format characters involve the backslash (so Access interprets them
literally) with asc(251) and asc(252) which are the check mark and cross in
the Wingdings font.

Now you need another unbound text box behind the first one (Format | Send to
Back), and with its TabStop property set to No so Access does not go there
by tabbing.

In the Enter event of the bound text box, SetFocus to the unbound one, and
set its Value so it shows the desired character (check mark or cross). In
its Change event, and Click event, toggle to the other character, and assign
the opposite value to the bound control.

Visually, this does work correctly on a continuous form, i.e. the unbound
text box only jumps in front on the current record row. The idea will need
some honing to handle the Undo event and so forth.

Once you get that working okay, you should be able to apply conditional
formatting because you are now working with a text box.
 
Back
Top