Fix a Missing Operator in a Microsoft Access SQL DELETE Statement
Question details
Correct an Access SQL DELETE statement that produces a missing operator or syntax error in an OleDb application.

- Product
- Microsoft Access and OleDb
- Device & OS
- not provided
- Scenario
- An application needs to delete records from an Access table using multiple conditions.
- Observed behavior
- The DELETE query returns a syntax error when FROM is omitted or conditions are combined incorrectly.
Check the table and field names in Access and identify the data type of each value used in the WHERE clause. Run an equivalent SELECT query with the same conditions to verify which records will be deleted.
Correct the Access DELETE syntax and use OleDb parameters
Use FROM and AND to form a valid DELETE statement, then pass values as parameters rather than concatenating them into SQL.
In the application's OleDbCommand, use a statement such as: DELETE * FROM [people] WHERE [Id] = ? AND [Name] = ?. Replace the table and field names with those in your database, and join additional conditions with AND.
Add one OleDbParameter for each ? placeholder to the command's Parameters collection. Add the Id value first and the Name value second, using OleDb types that match the corresponding Access fields.
Before executing the DELETE command, run SELECT * FROM [people] WHERE [Id] = ? AND [Name] = ? with the same parameter values and confirm that the results are the intended records.
Open the OleDbConnection and call ExecuteNonQuery on the parameterized DELETE command. Check the returned row count to see how many records were deleted.

Work with exported Access data in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with exported tabular data and other Office files. It supports common Microsoft Office formats for easy migration, but it does not execute Access SQL or fix OleDb queries.

Frequently Asked Questions
What is the correct DELETE syntax in Access SQL?
Use DELETE * FROM [table_name] WHERE condition. For multiple conditions, join them with AND or OR as appropriate, for example: DELETE * FROM [people] WHERE [Id] = ? AND [Name] = ?.
Why does OleDb require parameters in a particular order?
OleDb matches ? placeholders by position. Add values to the OleDbCommand Parameters collection in the same order as the placeholders appear, regardless of parameter names.
How can I check which records will be deleted?
Run a SELECT query with the same FROM and WHERE clauses and the same parameter values. Review the results before running the DELETE command.
Can WPS Office run an Access DELETE query?
No. Run the query through Access or your OleDb application. WPS Spreadsheets can open supported spreadsheet files exported from Access for review.




