In a subroutine I have the following code:
SQL = "select CALENDAR.DATE from CALENDAR where Format CALENDAR.DATE,'mmyyyy')=Format(" & desiredDate & ",'mmyyyy');"
Set daysOfMonth = db.OpenRecordset(SQL, dbOpenSnapshot)
where desiredDate is either "January 1, 2001" or 36892
This does not work. If, however, I replace " & desiredDate & " with date() I can get the current month's worth of dates into the recordSet. Why is this?
SQL = "select CALENDAR.DATE from CALENDAR where Format CALENDAR.DATE,'mmyyyy')=Format(" & desiredDate & ",'mmyyyy');"
Set daysOfMonth = db.OpenRecordset(SQL, dbOpenSnapshot)
where desiredDate is either "January 1, 2001" or 36892
This does not work. If, however, I replace " & desiredDate & " with date() I can get the current month's worth of dates into the recordSet. Why is this?