Check Boxes Have Label Controls That 'Work'

A

Access User

In developing this form, I created a bunch of check-boxes with "Yes" as their
defaults. Let's say one is called 'PCA_L' and its label control were called
"label37". I have 'discovered' that when I click in "label37" the effect is
to 'toggle' the check-box's value to the other one. I am running A2002 btw.
So, here's my question: can I have the color of the label conditioned on the
value of the check-box? At this point, 'label37' has a default white bckgrnd
and black lettering. When it's used to 'toggle' the value of the 'PCA_L' from
"Yes" to "No", I would like 'label37' bckgrnd to go to red and the lettering
to go to yellow. When it's used to 'toggle' 'PCA_L' back to "Yes", I would
like the colors of 'label37' to return to black lettering on white bckgrnd.

Is that a doable thing?
 
K

Klatuu

Use the After Update event of the check box:

If Me.MyCheckBox = True Then
Me.Label37.BackColor =
Me.Label37ForeColor =
Else
Me.Label37.BackColor =
Me.Label37ForeColor =
End If
 
R

Ron2006

If the checkbox is stored in the table so that it is already set when
you are looking at the form, then you will want the above code ALSO in
the OnCurrent event of the form.
 
M

monma01 via AccessMonster.com

Ron2006 said:
If the checkbox is stored in the table so that it is already set when
you are looking at the form, then you will want the above code ALSO in
the OnCurrent event of the form.

Or if you don't want to duplicate lots of code and have to edit it in
multiple places, such as if you wanted to change what the colors should be
changed to, just add a call to the update event in the form's current event:

Private Sub Form_Current()
MyCheckBox__AfterUpdate
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top