"2D Rick" <rb*******@compuserve.comwrote in message
news:11**********************@i13g2000prf.googlegr oups.com...
I want to open a report using OpenReport and passing it a Where Clause
with multiple criteria.
I know the Where Clause below is way off but it conveys what I need.
Dates are of string type.
DoCmd.OpenReport "rpt_LOG", acViewPreview, , WHERE????
strDate1 = "Friday, July 20, 2007"
strDate2 = "Saturday, July 21, 2007"
strDate3 = "Sunday, July 22, 2007"
"[Weekend_Date] = """ & strDate1 & """ and """ & strDate2 & """ and
""" & strDate3 & """"
Confused
Rick
[Weekend_Date] can't be equal to all 3 dates at the same time, you may want
to use OR. Assuming [Weekend_Date] is a date type you need to use # around
the date and supply a date value.
"[Weekend_Date]=#" & datevalue(strDate1) & "# OR [WeekendDate]=#" &
datevalue(strDate2) & "# OR [WeekendDate]=#" & datevalue(strDate3) & "#"
or if your criteria is always Friday Saturday and Sunday
"[Weekend_Date] between #" & datevalue(strDate1) & "#" and "#" &
datevalue(strDate3) & "#"
If [Weekend_Date] stores date and time, add 1 date to last date
"[Weekend_Date] between #" & datevalue(strDate1) & "#" and "#" &
dateadd("d",1,datevalue(strDate3)) & "#"