conditional formatting label??

  • Thread starter Thread starter Guest
  • Start date Start date
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.
 
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
 
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
 
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.
 
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
 
Back
Top