Label Formatting Question

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

Guest

The example below works. but it stays yellow for all records. I need it
only to turn yellow if checked on a specific record. How do I write this so
that it only works on specific record. Thank you in advance for any help
provided.


If CheckBoxName = True Then
LabelName.ForeColor = vbYellow
Else
LabelName.ForeColor = vbBlack
End If
 
Change the label to a textbox, and change the properties of the textbox to
make it look like a label. Be sure to set its Enabled property to No and its
Locked property to Yes. To show the text that the original label has as the
caption, use this expression as the control source of the textbox:
="put the label caption text here"

Then use Conditional Formatting for that textbox to change the Font color
(ForeColor) as you desire.
 
TotallyConfused said:
The example below works. but it stays yellow for all records. I need it
only to turn yellow if checked on a specific record. How do I write this so
that it only works on specific record. Thank you in advance for any help
provided.


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


That should work if the form is in single view. However, if
the form is in continuous or datasheet view, you should not
use code to set a control's formatting properties because of
the problem you are seeing.

Instead, you need to change the label to a locked text box
and use Conditional Formatting on the Format menu.
 
Back
Top