Hide Null Fields and Labels in an Access 2016 Report
Question details
Hide a null field and its associated label in an Access 2016 report and reduce the resulting blank space.

- Product
- Microsoft Access 2016
- Device & OS
- not provided
- Scenario
- A report contains vertically arranged fields, some of which may be null for a given record.
- Observed behavior
- The desired report shows neither the text box nor its label when the field is null, with unused vertical space reduced where possible.
Open the report in Design View and identify the text box and label names on the Other tab of the Property Sheet. The text box should be bound to the field you want to check.
Use the Detail section's Format event to hide empty controls
Use VBA to hide both the text box and label for null values, then enable shrinking to reduce unused space.
The Format event runs when Access formats the report for printing or Print Preview. The code also makes the controls visible again for records where the field is not null.
In the Navigation Pane, right-click the report and select Design View. Select the text box and open the Property Sheet if it is not already visible.
On the text box's Format tab in the Property Sheet, set Can Shrink to Yes. Select the Detail section and set its Can Shrink property to Yes as well.
Select the Detail section, open the Event tab in its Property Sheet, and click the Build button (…) next to On Format. Choose Code Builder if prompted.
Between the existing procedure lines, enter: If IsNull(Me.txtSomeField) Then Me.txtSomeField.Visible = False Me.lblSomeLabel.Visible = False Else Me.txtSomeField.Visible = True Me.lblSomeLabel.Visible = True End If Replace txtSomeField and lblSomeLabel with the actual control names from the Property Sheet.
Save the report, then open Print Preview and check records with and without a value. Adjust the vertical layout if other controls prevent the section from shrinking.

Work with Office Documents in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with compatible Office documents. Open existing files to make migration easier; it does not replace Access or fix Access report formatting.

Frequently Asked Questions
Where do I find the text box and label names?
Open the report in Design View, select each control, and check the Name property on the Other tab of the Property Sheet. Use those names in the VBA code.
Will Can Shrink hide the label automatically?
No. Can Shrink can reduce unused space, but the label's visibility must be controlled separately, such as with the Detail section's On Format event.
Why are the controls still visible in Report View?
The Detail section's Format event is intended for formatting the report for printing and may not run the same way in Report View. Check the result in Print Preview.
Why is there still a blank gap after hiding a field?
In Design View, check that Can Shrink is set to Yes for both the text box and the Detail section. Other controls occupying the same vertical area can also prevent the section from shrinking.




