I'm not understanding why I can't compare dates with an SQL statement when creating a recordset object.
These querys works fine:
"SELECT * FROM Calls WHERE [CallDate] = Now()"
"SELECT * FROM Calls WHERE [CallDate] = DateSerial(Year(Now()), Month(Now())..."
But then querys like the following result in errors, saying there was an expected equation.
Dim Date1 As Date
Date1 = Now()
"SELECT * FROM Calls WHERE [CallDate] = Date1"
-or-
"SELECT * FROM Calls WHERE [CallDate] = DateSerial(Year(Date1)), Month(..."
I've been trying several syntax possibilites like using single quotes, the date value, the date value in single quotes, but nothing is working. Any Help?
These querys works fine:
"SELECT * FROM Calls WHERE [CallDate] = Now()"
"SELECT * FROM Calls WHERE [CallDate] = DateSerial(Year(Now()), Month(Now())..."
But then querys like the following result in errors, saying there was an expected equation.
Dim Date1 As Date
Date1 = Now()
"SELECT * FROM Calls WHERE [CallDate] = Date1"
-or-
"SELECT * FROM Calls WHERE [CallDate] = DateSerial(Year(Date1)), Month(..."
I've been trying several syntax possibilites like using single quotes, the date value, the date value in single quotes, but nothing is working. Any Help?