How to Fix Microsoft Access Running a Query After Closing a Report
Question details
The user needs to stop Microsoft Access from automatically executing a long-running query immediately after closing a filtered report.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Closing a filtered report that was opened using DoCmd.OpenReport with a WHERE string variable.
- Observed behavior
- Access unexpectedly runs a query that takes as long as the original opening query, delaying normal operations.
Ensure you have Design View permissions for the affected database objects and that no other users are currently locking the report.
Remove Filter Actions from the Report's Close Event
Use this solution to remove unintended macros or code in the Close event that trigger a requery by removing the applied report filter.
Often, a macro or VBA command is accidentally left in the report's Close event. If this action attempts to remove or alter the active filter, Access is forced to rerun the underlying query against the entire dataset before fully closing the object.
Open your database in Microsoft Access, locate the problematic report in the Navigation Pane, right-click it, and select 'Design View'.
Click 'Property Sheet' on the Design ribbon, or press F4 on your keyboard to display the properties pane.
In the Property Sheet, click on the 'Event' tab and find the 'On Close' row.
If you see a macro name or '[Event Procedure]' in the 'On Close' field, click the ellipsis (...) button next to it to open the Macro Builder or VBA Editor.
Identify the specific command or macro step that removes the filter, delete it, and save your changes. Close the editor and test the report.

Check Form Focus and Active Events
Check background forms for event properties that might unintentionally trigger a requery when the report closes.
Boost Your Data Workflow with WPS Office
While Microsoft Access handles heavy database management, WPS Office provides an incredibly fast and lightweight solution for analyzing exported database reports, formatting daily documents, and presenting your data findings without the high subscription costs.
- 1. Download the Installer: Visit the official WPS Office website and click the free download button.
- 2. Install the Suite: Run the downloaded file and complete the quick, lightweight installation process.
- 3. Analyze Exported Data: Open your exported Access reports in WPS Spreadsheets to quickly filter, analyze, and chart your information.

Frequently Asked Questions
Why does my Access report take so long to close?
This usually happens because an action or macro in the 'On Close' event is configured to remove or alter the report's filter. Removing a filter forces Access to rerun the query against the entire underlying table or database before it finishes closing.
Does DoCmd.OpenReport automatically cause a query to run when closing?
No, the DoCmd.OpenReport command itself only dictates how the report opens. If a query runs on close, it is triggered by an event property within the report itself or by a background form regaining focus.
How do I find out if my Access form has hidden focus code?
Open the form in Design View, press F4 to open the Property Sheet, and select the Event tab. Look for entries next to 'On Got Focus', 'On Lost Focus', or 'On Activate'. If it says '[Event Procedure]', click the ellipsis button to view the VBA code.




