I need to open a report based on two conditions. One condition is a user's
name, which is provided from a listbox on a form. The other condition is a
start date(sd) and end date(ed), which are provided from two calendar
controls on a form. I am trying to use the code below to open the report but
it doesn't work. Do you know how I can open a report using the conditions
stated?
sd = Form_Calendar.beg_date
ed = Form_Calendar.end_date
strLinkCriteria = "[BG_Responsible]=" & "'" & Me.List54.Value & "'"
strReportCriteria = "[HS_CHANGE_DATE] between #" & sd & "# and #" & ed & "#"
DoCmd.OpenReport stDocName, acViewPreview, strReportCriteria, strLinkCriteria
Combine the two criteria into a single clause:
sd = Form_Calendar.beg_date
ed = Form_Calendar.end_date
strLinkCriteria = "[BG_Responsible]='" & Me.List54.Value & "' And " & _
"[HS_CHANGE_DATE] between #" & sd & "# and #" & ed & "#"
DoCmd.OpenReport stDocName, acViewPreview, , strLinkCriteria

Signature
Ken Snell
<MS ACCESS MVP>
>I need to open a report based on two conditions. One condition is a user's
> name, which is provided from a listbox on a form. The other condition is a
[quoted text clipped - 13 lines]
> DoCmd.OpenReport stDocName, acViewPreview, strReportCriteria,
> strLinkCriteria
Lewis M - 10 Jul 2006 14:13 GMT
Ken, thanks. Your tip worked great.
> Combine the two criteria into a single clause:
>
[quoted text clipped - 23 lines]
> > DoCmd.OpenReport stDocName, acViewPreview, strReportCriteria,
> > strLinkCriteria