Error in SQL ???

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I run the below SQL, I get "Data type mismatch in criteria expression".
Can anyone see the problem? I know its in the DATEDIFF expression. I've been
trying to debug this for 2 hours.
All table columns are strings. Using Access 2000.

SELECT COUNT(*) As Tot FROM tblSSRData
WHERE [CURRENT STATUS] NOT IN ('CLS','PRO','RTP')
AND [PRI] = '1'
AND DATEDIFF('d',CDate([TASK CREATED]),Now()) >= 0
AND DATEDIFF('d',CDate([TASK CREATED]),Now()) <= 30
 
It sounds like you already answered your own question in a later post??? The
[TASK CREATED] is a Text field but the date text is not the same format as
your Regional Settings???

BTW, use Date() rather than Now() since you have only date value and no time
component.
 
Back
Top