Others

Troubleshoot Microsoft Access Queries That Do Not Run from VBA

John WilsonJohn Wilson Nov 27, 2026 868 views

Question details

Identify why Access action queries appear not to run when called from VBA, even though they work when run manually.

Troubleshoot Microsoft Access Queries That Do Not Run from VBA
Product
Microsoft Access
Device & OS
not provided
Scenario
A VBA procedure runs action queries or SQL statements to populate tables, including an append query.
Observed behavior
The queries appear to do nothing from VBA, and warning or error messages may not be visible.
Before you start

Open the database and identify the VBA procedure and action queries involved. Note the source and destination tables for each statement so you can check them in sequence.

Solution 1Recommended

Restore Access warnings and add error handling

Use this approach when VBA runs without displaying the usual action-query warnings or useful error details.

1
Inspect the VBA procedure

Press Alt+F11 to open the VBA editor, locate the procedure that runs the queries, and search its code for DoCmd.SetWarnings False.

2
Restore warnings on exit

Add DoCmd.SetWarnings True after the statements that require warnings to be disabled. Route both normal completion and errors through a cleanup section that restores warnings.

3
Report errors

Add an On Error handler to the procedure and display or log Err.Number and Err.Description before leaving through the cleanup section.

4
Run the procedure again

Run the procedure from Access or the VBA editor and check any warning or error message to identify the statement that needs attention.

Restore Access warnings and add error handling
Warnings are not proof of success: Restoring warnings makes action-query prompts visible, but you should still check the resulting records and handle VBA errors.
Free Microsoft Office alternative

Work with Office documents and spreadsheets in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with Office files. It supports common Microsoft Office formats for an easier transition, but it does not troubleshoot Access or run Access databases and VBA procedures.

Open and edit spreadsheets in Microsoft Excel formats such as XLSXReview tabular data in WPS SpreadsheetsWork with Microsoft Word and PowerPoint formats, including DOCX and PPTXUse a familiar interface in a lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why does my Access action query run without a confirmation prompt?

The VBA procedure may have called DoCmd.SetWarnings False. Check the procedure in the VBA editor and restore warnings with DoCmd.SetWarnings True, including in its error cleanup.

Why does an append query add no records?

The source table may be empty, the criteria may match no records, or an earlier statement may have populated the wrong table. Open the source table or run the underlying select query to check the records.

How can I tell which VBA statement is failing?

Add an On Error handler that reports Err.Number and Err.Description. You can also add Debug.Print statements around each query and inspect the Immediate window in the VBA editor.

Can WPS Office run my Access database and VBA queries?

No. Use Microsoft Access to run and troubleshoot Access databases and VBA queries. WPS Office can instead be used for common Office documents and spreadsheets, including XLSX files.