PDA

Click to See Complete Forum and Search --> : sSQL Problem


gvirden
Mar 23rd, 2000, 08:59 PM
Why is this statement rejected?

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"

JHausmann
Mar 24th, 2000, 12:25 AM
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"

gvirden
Mar 24th, 2000, 01:05 AM
Perfect! Thanks