Skip to content
Advertisement

Data type mismatch on SQL Query in VBA

I am trying to do an SQL query in VBA to retun a specific case number. Whenever I execute the query, it returns an error of “Data Type Mismatch in Criteria Expression”. I am passing the query an integer to use to query an autonumber primary key.

Of course the debug hilights the execute command. Any help would be appreciated. Am I passing the wrong datatype to match the autonumber? If so, what datatype should I be using? Thanks!

Advertisement

Answer

if CASE_ID_NBR has numeric type, you should use it without quotes:

you may also want to read this: Global Variables in SQL statement

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement