-
Why is this statement rejected?
Code:
sSQL = "SELECT * FROM EquipRunTime WHERE pond = '" & rsPonds!pond & "' " & _
"(thedate BETWEEN #" & Format(DateAdd("h", -24, dtCurrent), "General Date") & "# AND #" & _
Format(dtCurrent, "General Date") & "#)AND NOT Cleared ORDER BY thedate DESC"
-
Give this a shot (you're definitely missng an and between the first condition and the second. I also tend to avoid exclamation points when accessing objects. It's not invalid, yet, but it is being phased out) :
sSQL = "SELECT * FROM EquipRunTime WHERE pond = '" & rsPonds.pond & "' and " & _
"(thedate BETWEEN #" & Format(DateAdd("h", -24, dtCurrent), "General Date") & "# AND #" & _
Format(dtCurrent, "General Date") & "#)AND NOT Cleared ORDER BY thedate DESC"
-