Microsoft Access error - Data type mismatch in criteria expression

Milnor, Deanna L 20 Reputation points
2025-10-21T19:10:28.39+00:00

Receive error in Microsoft Access when running a query - data type mismatch in criteria expression. How can I resolve this error?

Microsoft 365 and Office | Access | For business | Windows

Answer accepted by question author
Ken Sheridan 3,581 Reputation points
2025-10-22T11:29:30.1766667+00:00

In a query's WHERE clause:

Values of text data type must be delimited by literal quote characters, e.g. Product = "Widget"

Values of DateTime data type must be delimited by # characters and be either in US date format or an otherwise internationally unambiguous format such as the ISO standard for date notation of YYYY-MM-DD, e.g. TransactionDate = #2025-07-04#

Values of a number data type do not need delimiters, e.g EmployeeID = 666

If a parameter is used the parameter does not need to be delimited, whatever its data type, e.g. AppointmentDate >= Forms!MyForm!txtApppointmentDate

A common reason for a type mismatch error is where the actual value in a column is a number, but the value seen in the column in datasheet view or in a control in a bound form is looked up in a related table. This will be the case if the 'lookup field' wizard has been used when the column was created in table design view. For example, in a table of Addresses or similar, you might have a column containing a CityID numeric value, but you'll see a value of text data type such as London. In this case you can either use the numeric CityID value (without delimiters), which will be the primary key of the referenced Cities table, or join the Addresses and Cities table in a query, in which case the criterion City = "London" can be on the text City column or similar in the Cities table.

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

2 additional answers

Sort by: Most helpful
  1. Nacif Boudlal 0 Reputation points
    2026-12-01T08:59:33.8233333+00:00

    Hi,

    This message means the query compares two things of different types: a number with text, a date with text, or two fields of different types in a join. Without the query it's hard to say which, but it's almost always one of these:

    1. A number in quotes. Criteria "5" or '5' on a Number field. Remove the quotes.
    2. Text without quotes on a Short Text field, for example a zip code or a reference: 0123 has to be "0123".
    3. A date written as text. In the query grid, write dates between hash signs: #10/21/2025# (US order month/day/year), not "21/10/2025".
    4. A lookup field. The table shows a label ("Boston") but stores a number (the ID). A criteria "Boston" on that field fails. Use the ID, or add the lookup table to the query and put the criteria on its name field.
    5. A join between fields of different types. Open the tables in Design view and compare the Data Type of the two joined fields (Short Text on one side, Number on the other is common after importing from Excel).
    6. A calculated column that fails on some rows (CDate, CLng, Val on an empty or text value) and has a criteria on it. The error then appears only with certain data.

    To find the culprit: open the query in Design view and remove the criteria one at a time, running the query after each. When the error disappears, the last criteria you removed is the one; check the Data Type of that field in its table. If no criteria is left and it still fails, look at the joins and calculated columns.

    If you post the SQL (Design view > SQL view), I can point to the exact line. The full list of causes, with the VBA versions, is here: https://auscult.nbit-tech.fr/en/access-error-3464.html?utm_source=msqa&utm_medium=forum (disclosure: I make Auscult, the linked site).

    Was this answer helpful?

    0 comments No comments

  2. DBG 11,801 Reputation points Volunteer Moderator
    2025-10-21T19:19:58.0066667+00:00

    Can you post some screenshots showing the error message and the design view of your query? Also, consider posting the SQL statement for your query.

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.