conditional formatting label??

G

Guest

How do you write code to format label of checkbox? I have a checkbox that I
would like to have the text label turn yellow if checkbox is True. I have
used options in Conditional Formatting therefore I can't use Conditional
formatting for this check box. Any help will be greatly appreciated. Thank
you.
 
G

Guest

In the After Update Event of the check box, put the following code
(substituting your check box and label names as appropriate)

If CheckBoxName = True Then
LabelName.ForeColor = vbYellow
Else
LabelName.ForeColor = vbBlack
End If
 
G

Guest

Thank you it worked! Have a great day!

Dennis said:
In the After Update Event of the check box, put the following code
(substituting your check box and label names as appropriate)

If CheckBoxName = True Then
LabelName.ForeColor = vbYellow
Else
LabelName.ForeColor = vbBlack
End If
 
G

Guest

Sorry, but the color stays yellow if I scroll to the next record. I need the
color to change only on record that it was checked for. My PK is [DocID].
Can this be done? Thank you.
 
G

George Nicholson

put the same If..Then..Else block of code in the Form_Current event. That
will handle the color change when scrolling record-to-record.

The AfterUpdate event will only change the colors if you change the checkbox
by clicking on it.

HTH,


TotallyConfused said:
Sorry, but the color stays yellow if I scroll to the next record. I need
the
color to change only on record that it was checked for. My PK is [DocID].
Can this be done? Thank you.

Dennis said:
In the After Update Event of the check box, put the following code
(substituting your check box and label names as appropriate)

If CheckBoxName = True Then
LabelName.ForeColor = vbYellow
Else
LabelName.ForeColor = vbBlack
End If
 

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