Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

conditionally changing title

Status
Not open for further replies.

pullingteeth

Programmer
Sep 26, 2003
128
US
I have a boolean field coming into a report; I would like to change the title of a section based on the field.

I currently do this by "displaying" the field, but setting visibility to false; then I have two fields which each of the alternate titles. In the report_activated event procedure, I test the value of the boolean, and set the visibility of one of the alternates to false so that the correct title shows. However, this isn't exactly neat, which leads to my question: how do I change the value of a caption, programatically?

Thanks
 
PullingTeeth,
You can set the caption property of a label in the On Format event of the section containing the label. Bind the boolean field to a text box "txtBoo" and use code like:
If Me.txtBoo = -1 Then
Me.lblMyLabel.Caption = "Red"
Else
Me.lblMyLabel.Caption = "White"
End If

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
Thank you. For some reason, "Caption" wasn't showing up in the code-assistant, so I assumed that it wasn't an available property in reports.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top