Question : SQL Query Error -- Data type mismatch in criteria expression

I am receiving the following error:  Microsoft OLE DB Provider for ODBC Drivers error '80040e07'  [Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression

Here is the script
----------------------------------------------------------------------------------------------------------------
' Query the table from the db
sql = "SELECT Response, Checklist, Details FROM Data WHERE Checklist =
 'Zip' AND Response = 'Not Mustangs'"

' Execute the sql
rs.Open sql, cn
-----------------------------------------------------------------------------------------------------------------
When I set the WHERE filter for Checklist = 'Zip' for example it works, but when I add the AND criteria I get the above error.  I am using Access database.

Answer : SQL Query Error -- Data type mismatch in criteria expression

>>Response is a keyword in ASP, That's why I enclosed it in brackets.

It also needs to be enclosed in brackets in select list e.g.

sql = "SELECT [Response], Checklist, Details FROM [Data] WHERE [Checklist] = 'Zip' AND [Response] = 'Not Mustangs';"
Random Solutions  
 
programming4us programming4us