It's error 3464: Data type mismatch in criteria expression. What's interesting, I get the error only when resulting recordset wouldn't be empty. For instance, assuming there's only 1 record in "tbMessage" table of expirationDate = today's date. In this case the expresion:
Code:
CurrentDb.OpenRecordset("SELECT * FROM tbMessage WHERE messageType = 2 AND expirationDate <= #12/18/2014#")
wouldn't result in empty recordset hence there would be the error. If I changed it to:
Code:
"..expirationDate = #12/18/2014#")
or
Code:
"..expirationDate >= #12/18/2014#"
no error would be produced and it'd performed correctly. Don't really get it.
I think it might have something to do with date format. In sql it's american so mm/dd/yyyy, in the table it's dd-mm-yyyy though i'm not sure if it's not only the way it's displayed there.
Robert