Connecting Tech Pros Worldwide Forums | Help | Site Map

Conditional Formatting of a label on a report

Member
 
Join Date: Apr 2009
Posts: 53
#1: May 5 '09
I have a Label on a report with a check box from a table indicating True or False. I would like to have the labels that are true to highlight yellow using conditional foramtting. The False labels to remain unhighlighted. I have tried changing the label to a text box and then conditional formatting "Expresion Is" "BILL"=TRUE. But the formatting is not working. I loose my Label text and BackColor does not change. Any Suggestions?

Expert
 
Join Date: Jul 2008
Location: Maryland
Posts: 1,175
#2: May 5 '09

re: Conditional Formatting of a label on a report


Try changing "BILL" to [BILL].
Member
 
Join Date: Apr 2009
Posts: 53
#3: May 5 '09

re: Conditional Formatting of a label on a report


That worked to get my background highlighted. But because I have to change the label to a txtbox, in order to conditianally format it, the label text is gone. How can I gat the label text to come back?
Expert
 
Join Date: Jul 2008
Location: Maryland
Posts: 1,175
#4: May 5 '09

re: Conditional Formatting of a label on a report


You can set the control source of the text box (in properties or by typing into the box) to
Expand|Select|Wrap|Line Numbers
  1. = "Label Text"
You do need to type in the equals sign.
Member
 
Join Date: Apr 2009
Posts: 53
#5: May 5 '09

re: Conditional Formatting of a label on a report


Great....That did it. Thanks for all your help.
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,217
#6: May 5 '09

re: Conditional Formatting of a label on a report


Quote:

Originally Posted by Desitech View Post

I have a Label on a report with a check box from a table indicating True or False. I would like to have the labels that are true to highlight yellow using conditional foramtting. The False labels to remain unhighlighted. I have tried changing the label to a text box and then conditional formatting "Expresion Is" "BILL"=TRUE. But the formatting is not working. I loose my Label text and BackColor does not change. Any Suggestions?

In the Detail Event of the Report, try something similar to:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
  2. If Me![<Check Box Name>] Then
  3.   Me![<Label Name>].ForeColor = vbYellow
  4. Else
  5.   Me![<Label Name>].ForeColor = vbBlack
  6. End If
  7. End Sub
Reply


Similar Microsoft Access / VBA bytes