How to Suppress Microsoft Access Report Grouping with a Parameter
Question details
The user wants to conditionally hide group sections in a Microsoft Access report using a parameter, allowing a single report to handle both grouped and ungrouped data presentations.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Creating dynamic database reports where users can choose to see data with or without specific groupings.
- Observed behavior
- Need to implement a parameter-driven condition to toggle the visibility of the group section dynamically without creating a separate duplicate report.
Ensure you have design-level access to the Microsoft Access database and basic familiarity with modifying report events using the Property Sheet.
Use the On Format Event to Toggle Section Visibility
You can control the display of group headers or footers by reading a parameter in the section's On Format event using VBA.
By dynamically changing the Visible property of a group section during the report's formatting phase, you can reuse one report layout for multiple presentation needs. This is typically done by referencing a parameter from an open form.
Right-click your target report in the Access Navigation Pane and select 'Design View' from the context menu.
Click the bar for the Group Header or Group Footer section that you want to conditionally suppress.
Press F4 or click 'Property Sheet' on the Report Design ribbon to view the section's properties. Switch to the 'Event' tab.
Find the 'On Format' property row, click the ellipsis (...) button on the right, and choose 'Code Builder' to open the VBA editor.
Write VBA code to evaluate your parameter. For example: If Forms!MyForm!chkUngrouped = True Then Me.GroupHeader0.Visible = False Else Me.GroupHeader0.Visible = True End If.
Save the report and switch to Print Preview mode to test both parameter states, ensuring the group section hides and displays as expected.

Handle Your Exported Reports Easily with WPS Office
While Microsoft Access handles the backend database logic, you often need to export those reports for presentation and further analysis. WPS Office is a lightweight, free alternative to Microsoft Office that perfectly handles all your exported document needs.

Frequently Asked Questions
Will hiding the group header also hide the detail records?
No. Setting the Visible property of a Group Header or Group Footer to False only hides that specific grouping section. The Detail section containing the actual records will still be processed and displayed.
Why isn't my On Format event firing in Access?
The On Format event only triggers when you preview the report in 'Print Preview' mode or actually send it to the printer. If you are viewing the report in standard 'Report View', format events are ignored by Access.
Can I suppress a report group section using macros instead of VBA?
Yes, you can use the 'SetProperty' macro action within the On Format event of the group section. You would use an 'If' block in the macro to check your parameter and set the Visible property to False.




