View Full Version : Comparing A date to a date


StevenAFC
07-07-2008, 02:40 AM
Hi,

In my database set up I have a field called start date which is a shortdate datatype.

When I compare the information from a date picker I get a data type mismatch error.

Could you help?

Set rs = CurrentDb.OpenRecordset("SELECT ID, startDate, endDate FROM tblLeave WHERE startDate > '" & dpkEndDate & "'")


dpkEndDate being the datepicker.

namliam
07-07-2008, 02:43 AM
Your problem is in using ' around your date. Quotes are for strings.

Use # for dates.... That should resolve your issue(s)

StevenAFC
07-07-2008, 02:46 AM
Thanks a lot!

Did not know about #!