Others

Hide an Empty Subreport and Its Label in Microsoft Access

Amos GikundaAmos Gikunda Nov 13, 2026 869 views

Question details

Hide a subreport and its associated label when the subreport contains no records.

Hide an Empty Subreport and Its Label in Microsoft Access
Product
Microsoft Access
Device & OS
not provided
Scenario
A parent report contains a subreport control and a separate label in the same section.
Observed behavior
When the subreport has no records, neither the subreport nor its label should appear in the formatted report.
Before you start

Open the parent report in Design View and identify the names of the subreport control, its label, and the section that contains them. The subreport control name can differ from the name of its source report.

Solution 1Recommended

Use the parent section's Format event to hide both controls

Use the subreport's HasData property to control the visibility of both the subreport and its label.

1
Open the report in Design View

In the Navigation Pane, right-click the parent report and select Design View.

2
Check the control names

Select the subreport control, open Property Sheet, and note its Name on the Other tab. Repeat for the label in the parent report.

3
Create a Format event procedure

Select the parent report section containing the subreport control. In Property Sheet, open the Event tab, choose On Format, select [Event Procedure], and click the ellipsis button.

4
Add the visibility code

Inside the generated event procedure, add: Dim hasRecords As Boolean hasRecords = Me.[NameOfSubreportControl].Report.HasData Me.[NameOfLabel].Visible = hasRecords Me.[NameOfSubreportControl].Visible = hasRecords Replace both bracketed names with the parent report's actual control names.

5
Preview the result

Save the report and open it in Print Preview. Check it with records present and with no subreport records to confirm that both controls appear or disappear as expected.

Use the parent section's Format event to hide both controls
Format events and empty space: The Format event runs when the report is formatted for printing or Print Preview, not in Report View. To reduce space left by an empty subreport, set Can Shrink to Yes on the subreport control and, where appropriate, its containing section.
Free Microsoft Office alternative

Create and share report documents with WPS Office

WPS Office is a free, lightweight alternative for editing and sharing documents and spreadsheets in a familiar interface. Open common Microsoft Office files to make migration easier. It does not replace Microsoft Access or run Access report VBA.

Prepare report documents and spreadsheet summaries in a familiar interfaceOpen and edit Microsoft Word DOCX and Excel XLSX filesUse a free, lightweight office suite for everyday work
microsoft office alternative - wps office

Frequently Asked Questions

Why does Can Shrink leave the label visible?

Can Shrink can reduce empty space, but it does not automatically hide a separate parent-report label. Use the containing section's On Format event to set the label's Visible property based on the subreport's HasData property.

Which subreport name should I use in the code?

Use the Name of the subreport control on the parent report, not necessarily the source report's name. Select the control in Design View and check Property Sheet > Other > Name.

Why doesn't the Format event work in Report View?

The section Format event runs when Access formats the report for printing or Print Preview. Open the report in Print Preview to test the event.

Can I hide only the label if the subreport already shrinks?

Yes. In the containing section's On Format event procedure, use Me.[NameOfLabel].Visible = Me.[NameOfSubreportControl].Report.HasData, replacing the bracketed names with your control names.