Access error reference
Access error 3075: “Syntax error (missing operator) in query expression”
A search or filter button that worked yesterday stops on “Syntax error (missing operator)”. The message quotes the faulty expression: it is almost always SQL or a filter assembled in code.
The message
Syntax error (missing operator) in query expression '[CustomerID]='.
On a French Access: « Erreur de syntaxe (opérateur absent) dans l'expression « [CustomerID]= ». » Error number 3075 covers other syntax errors too: the start of the message tells you which.
Where it shows up
In criteria built by code: DoCmd.OpenForm "Details", , , "[CustomerID]=" & Me.txtId, Me.Filter, DLookup, DCount, CurrentDb.Execute, or a form's record source assembled in VBA.
Common causes
- an empty control:
"[CustomerID]=" & Me.txtIdgives “[CustomerID]=” when nothing is typed or selected; - a text value without quotes, or one containing an apostrophe (“O'Neil”) that cuts the string;
- a field name with a space not in brackets (
Order Dateinstead of[Order Date]); - a date or number in a regional format: “3,5” or “21/11/2026” pasted as is, instead of
Str()orFormat(…, "\#mm\/dd\/yyyy\#").
How to reproduce and check it
- Read the expression quoted in the message: what is missing after “=”, or the cut at an apostrophe, often stands out.
- Reproduce with the control empty, then with a value containing an apostrophe.
- Print the criteria before the call (
Debug.Print strWhere) to see exactly what Access receives.
How to fix it
Test the value before building the criteria (If IsNull(Me.txtId) Then Exit Sub), wrap text in quotes and double any quote inside, put names in brackets, and format dates and numbers independently of the PC's regional settings. A parameterised query avoids most of these cases.
What Auscult reports
The diagnostic recognises 3075 (the “syntax” family) wherever Access returns it. When the quoted criteria ends with “=” and comes from a control on the form, the fault is reported as conditional: “fails if you click without filling in the value searched for”, with the criteria involved. When a text field is concatenated without quotes, the report says so too: empty, the criteria is malformed; filled in, Access takes the value for a field name.
Measured on our test corpus: “missing operator” was recorded while analysing 52 of 965 applications.
Related errors
- 3061 — too few parameters, the same unquoted value once filled in
- 2465 — can't find the field
- The Access error reference, code by code