Evening all,
I could really use some expertise on the query below. It selects matches between two days (3 sets of two dates actually, depending on if the next set is empty or not); however, I get a syntax error in query expression when i open the form and it doesn't seems to work at all. Any help would be greatly appreciated.
Or if you'd prefer to read it in its natural form, look below:
Thanks in advance!
I could really use some expertise on the query below. It selects matches between two days (3 sets of two dates actually, depending on if the next set is empty or not); however, I get a syntax error in query expression when i open the form and it doesn't seems to work at all. Any help would be greatly appreciated.
Code:
strSQL6 = "
SELECT Students_Info.firstname, Students_Info.lastname FROM Students_Info WHERE
(
(#" & janumonthly & "# BETWEEN
DateAdd('m',1,Students_Info.startONE) AND
DateAdd('m',-1,Students_Info.gradONE)
)
and Students_Info.gradTWO Is Null)
OR
(
(#" & janumonthly & "# BETWEEN
DateAdd('m',1,Students_Info.startTWO) AND
DateAdd('m',-1,Students_Info.gradTWO)
)
and Students_Info.gradTHR Is Null)
OR
(#" & janumonthly & "# BETWEEN
DateAdd('m',1,Students_Info.startTHR) AND
DateAdd('m',-1,Students_Info.gradTHR)
);"
Or if you'd prefer to read it in its natural form, look below:
Code:
strSQL6 = "SELECT Students_Info.firstname, Students_Info.lastname FROM Students_Info WHERE ((#" & janumonthly & "# BETWEEN DateAdd('m',1,Students_Info.startONE) AND DateAdd('m',-1,Students_Info.gradONE)) and Students_Info.gradTWO Is Null) OR ((#" & janumonthly & "# BETWEEN DateAdd('m',1,Students_Info.startTWO) AND DateAdd('m',-1,Students_Info.gradTWO)) and Students_Info.gradTHR Is Null) OR (#" & janumonthly & "# BETWEEN DateAdd('m',1,Students_Info.startTHR) AND DateAdd('m',-1,Students_Info.gradTHR));"
Thanks in advance!