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?
Klatuu - 12 Mar 2008 20:19 GMT
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

Signature
Dave Hargis, Microsoft Access MVP
> 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
[quoted text clipped - 8 lines]
>
> Is that a doable thing?
Ron2006 - 12 Mar 2008 20:40 GMT
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.
monma01 - 12 Mar 2008 21:34 GMT
>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
Klatuu - 12 Mar 2008 21:35 GMT
Good point, Ron

Signature
Dave Hargis, Microsoft Access MVP
> 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.