How to Fix Microsoft Access VBA Error 3129 in Delete Queries
Question details
The user encounters Error 3129 in Microsoft Access VBA when attempting to run a DELETE query.

- Product
- Microsoft Access
- Device & OS
- not provided
- Scenario
- Executing a DELETE SQL query in Access VBA using a combo box value as the dynamic criteria.
- Observed behavior
- The VBA script throws Error 3129 or Error 3075, caused by passing the query variable as literal text instead of a variable, or by improperly formatting text criteria without quotation marks.
Before modifying your VBA script, open the VBA Editor (Alt + F11) and ensure the Immediate Window is visible (Ctrl + G) so you can print and inspect your SQL strings during troubleshooting.
Correct SQL Variable Execution and Syntax
Fix the error by executing the SQL string variable properly instead of passing it as literal text, and correctly formatting text criteria.
Passing a variable enclosed in double quotes (e.g., "strSQL") causes Access to read it as literal text rather than evaluating the SQL statement it contains. Adjusting the execution method and syntax will resolve Error 3129.
Assign your criteria variable using the combo box's default Value property. Focus is not required, so you can simply use 'selSubCon = Me!Combo4' instead of using the Text property.
Before executing the DELETE statement, insert an 'If IsNull()' statement to verify the combo box isn't empty, which prevents syntax errors from missing parameters.
Ensure your text criteria are enclosed in single quotation marks within the SQL string. Determine if your target field is a number or text; text fields require quotes around the variable.
Replace 'DoCmd.RunSQL "strSQL"' with 'CurrentDb.Execute strSQL'. This executes the contents of the variable rather than treating the variable name as the SQL command.

Troubleshoot Syntax with the Immediate Window
Use the Immediate window to expose hidden formatting errors, missing operators (Error 3075), or missing quotations in your generated SQL string.
Switch to WPS Office for Efficient Data Management
While WPS Office does not include a direct relational database equivalent to Microsoft Access, WPS Spreadsheet offers powerful data handling, pivot tables, and VBA-compatible macros to manage datasets efficiently without complex SQL queries. It's a highly compatible alternative to Microsoft Office.
- 1. Download WPS Office: Visit the official WPS website and download the free installation package.
- 2. Install and Launch: Follow the setup instructions to install the software, then open WPS Spreadsheet.
- 3. Import Your Data: Open your exported database files (such as CSV or XLSX) to perform advanced analysis using built-in spreadsheet tools and macros.

Frequently Asked Questions
Why do I get Error 3075 (Missing Operator) in Access VBA?
Error 3075 usually occurs when text criteria within your SQL string are not properly enclosed in single quotation marks. Access interprets the unquoted text as a missing parameter or operator. Ensure the generated SQL matches the field's specific data type.
Should I use DoCmd.RunSQL or CurrentDb.Execute for action queries?
It is generally recommended to use CurrentDb.Execute. It handles variables more cleanly, bypasses the standard Access warning prompts for action queries like DELETE or UPDATE, and operates more efficiently behind the scenes.
How can I check what my VBA SQL string actually says before running it?
You can add the code 'Debug.Print strSQL' right before your execution line. This prints the exact formulated string to the Immediate Window in the VBA Editor (accessible via Ctrl+G), allowing you to visually spot syntax and quotation errors.




