Question : data type mismatch

This is going to sound crazy.. but I have code that was working.. then 1 day it will just quit working... The error is Data type mismatch in criteria expression.

The front end is access and the tables are all in SQL2005. the field is a DateTime. I am sure it probably has to do with the references but I do not understand them enough to figure out which one. The one we usually change is the Microsoft ActiveX Data Objects 2.5 Library. We do not have standard Desktops here so some of the machines use 2.8 and some use 2.5 to get the date fields to work correctly. and yes we have 2 front ends that we need to maintain.. and yes it frustrates me to no end...

But now this will not work with either and I am at a loss& any suggestions& Please
Code Snippet:
1:
2:
3:
4:
calcdate = (Date - 3)
 
strsql = "Select * from [ExportDatamain] WHERE datevalue([DateExported]) = " & "#" & calcdate & "#"
Set Nst = db.OpenRecordset(strsql, dbOpenDynaset, dbSeeChanges)

Answer : data type mismatch

Try removing the DATEVALUE function and simply use the date field.
Scott C
Random Solutions  
 
programming4us programming4us