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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

code to change font colour of report labels if related text box empty

Status
Not open for further replies.

ch4meleon

Technical User
Jan 13, 2003
60
GB
I think this should be possible (?) just not sure how to do it, I have a report with 2 years with of figures for each client so i have a label for each month then the associated text box containing the data - what i want to do is turn the font colour of the label to white if the text box has no entry in it (e.g. client only been dealing with us for 6 months dont want to show 24 months with only 6 having data)
any suggestions most apriciated !!
:)
thanks in ant
 
How are ya ch4meleon . . .

In the [blue]On Format[/blue] event of the [blue]Detail Section[/blue] try this:
Code:
[blue]   If Trim([[purple][b]YourTextboxName[/b][/purple]] & "") = "" Then
      [purple][b]YourLabelName[/b][/purple].ForeColor = 16777215 [green]'White[/green]
   Else
      [purple][b]YourLabelName[/b][/purple].ForeColor = 0 [green]'Black[/green]
   End If[/blue]
Better would be to base the [blue]recordsource[/blue] on a query and [blue]only allow records where this textbox has data[/blue]. Makes for more compact reports . . .

Your thoughts? . . .

Calvin.gif
See Ya! . . . . . .
 
HUGE thanks for that, i did consider query but due to layout i want the report in im not 100% how to go about it to get it to work (im not normally this dizzy honest!!) Code is great tho so many many thanks :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top