-
Sorry to bother you again. I am stumped, and I have looked everywhere for
the solution but cannot find it. You have in the past been so kind in
helping me, I was wondering whether you would be prepared to help me again.
THis is my problem. Dates in SQL with VB. Why doesn't the following code
work!
Set patientDataLEAP = dbLEAP.OpenRecordset("SELECT * From patientRecords
Where DateOfRegistration < #01/08/99#")
Or
Set patientDataLEAP = dbLEAP.OpenRecordset("SELECT * From patientRecords
Where DateOfRegistration < '01/08/99')
Or
Set patientDataLEAP = dbLEAP.OpenRecordset("SELECT * From patientRecords
Where DateOfRegistration < " & Cdate(01/08/99))
How can I compare dates? Help
Any help is much appreciated.
Cheers
Angus
-
Hi,
This is the right one:
Set patientDataLEAP = dbLEAP.OpenRecordset("SELECT * From patientRecords
Where DateOfRegistration < #01/08/99#")
What you could do is try building the SQL statement in Access Query Designer. This will give you the correct syntax for your SQL Statement.
Also, what is the error message that you get? It might not even be comparing dates!
Preeti