This shows records
sqlStr = "SELECT * FROM Table1 WHERE DateOfHoliday >= #" & d1 & "#"
this doesn't
sqlStr = "SELECT * FROM Table1 WHERE DateOfHoliday >= #" & d1 & "# AND DateOfHoliday <= #" & d2 & "#"
d1
and d2
are datetimes, the format of DateOfHoliday
and d1
and d2
is the same (MM/DD/YYYY)
for example
Dim d1 As Date
d1 = #9/15/2021#
Dim d2 As Date
d2 = #11/29/2021#
One of the DateOfHoliday
is 9/28/2021
and the Debug.Print strSQL
returns :
SELECT * FROM Table1 WHERE DateOfHoliday >= #9/15/2021# AND DateOfHoliday <= #11/29/2021#