Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SQL Access 2010 querying by date "Data type mismatch in criteria expression."

Tags:

date

sql

I'm trying to make a query in Access 2010, but it keeps giving me this error "Data type mismatch in criteria expression."

The query is simple as

SELECT *
FROM mytable
WHERE date = '23-07-2013'

Any wonder why?

like image 817
coldpumpkin Avatar asked Nov 06 '13 10:11

coldpumpkin


2 Answers

SELECT *
FROM mytable
WHERE date = #7/23/2013#
like image 158
Madhivanan Avatar answered Nov 09 '22 04:11

Madhivanan


Access enclosed a date with # signs to indicate a literal value of date. And using a single quote in your case means you are comparing a String/Text with a Date data type thus the Data Type mismatch. It should therefore be:

 SELECT *
 FROM mytable
 WHERE date = #23/07/2013#
like image 26
Edper Avatar answered Nov 09 '22 05:11

Edper