Hiding labels on reports

B

BazEWR

How do you hide the labels on a report when the text box next to it is null?
And does anyone have the code to make the alternating background color for
each record result in details?
 
M

Marshall Barton

BazEWR said:
How do you hide the labels on a report when the text box next to it is null?
And does anyone have the code to make the alternating background color for
each record result in details?


If the label is not attached to another cotrol, hide the
label:
Me.thelabel.Visible = Not IsNull(Me.thetextbox)

If the label is attached to a text box and you want the text
box and its section to shrink, then Make the text box
invisible.

Either way, put the code in the Format event of the section
containing the label/textbox.
 
A

Allen Browne

In report design view, right-click the label and Change To | Text box.

Then enter an expression in its Control Source that only shows up when the
real text box has data. For example, if the label was attached to the City
text box, use:
=IIf([City] Is Null, Null, "City:")

You will find this is faster than code in the report's events, and you can
shink this quazi-label by settings its Can Shink property to Yes.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top