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

I am trying to make a request in Access 2010, but it continues to give me this error "Data type mismatch in criteria expression".

The request is simple as

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

No wonder why?

+4
source share
2 answers
SELECT *
FROM mytable
WHERE date = #7/23/2013#
+8
source

Access enclosed the date with C # characters to indicate the literal value of the date. And using one quote in your case means that you are comparing String / Text with the Date data type, thus a data type mismatch. Therefore, it should be:

 SELECT *
 FROM mytable
 WHERE date = #23/07/2013#
+7
source

All Articles