totn Access

MS Access 2003: Hide report object if no value

This MSAccess tutorial explains how to hide a report object if there is no value in Access 2003 (with screenshots and step-by-step instructions).

Question: In Microsoft Access 2003/XP/2000/97, I've created a report. In my report, I want to hide a text box if it has no value. Currently, if the text box value is nothing, a blank line is printed in the report. Is there a way to not print blank lines if my text box has no value?

Answer: First, it is important to note that the object that you are trying to hide must not be on the same line as any other objects. What this means is that the top/height of other objects must not overlap with the top/height of the object that you are trying to hide.

To hide your report object when it has no value, open your report in design view. Right-click on the report object that you wish to hide if no data is found.

In this example, we are going to hide the text box called ContactName.

Microsoft Access

When the Properties window appears, set the "Can Shrink" property to "Yes. By setting the "Can Shrink" property to "Yes, the Contact Name will not print a blank line if it has no value.

Let's look at a report to demonstrate the "Can Shrink" property.

If the "Can Shrink" property is set to "No" and the ContactName text box does not have a value, the report would look like this:

Microsoft Access

As you can see, there is no contact name for IBM, so a blank line has printed between "IBM" and "49 Gilbert St".

If we set the "Can Shrink" property to "Yes" on the ContactName text box, the example report would look like this:

Microsoft Access

Now, there is no blank line between "IBM" and "49 Gilbert St". The blank line that was once there has been removed because we set to the "Can Shrink" property to "Yes" for the text box.