Wayne,
Thank you for your reply but now I am more curious. Below is code on a
form unbound to any report. I use this form on multiple reports. The
end-user selects the choice from Filter 1 thru 5 and upon selecting press
the cmdSetFilter button and the report 'refilters', it does not open an
additional report or potentially 10 reports would be open. My problem
started when I tried to reuse this could to do Between StartDate and
EndDate.
In any event... What is happening here that allows my report to refilter
because if I understand you correctly it can't do that but it does.
Thanks,
Gina
Dim strSql As String, intCounter As Integer
'Build SQL String
For intCounter = 1 To 5
If Me("Filter" & intCounter) <> "" Then
strSql = strSql & "[" & Me("Filter" & intCounter).Tag & "] " & "
= " & Chr(34) & Me("Filter" & intCounter) & Chr(34) & " And "
End If
Next
If strSql <> "" Then
'Strip Last " And "
strSql = Left(strSql, (Len(strSql) - 4))
'Set the Filter property
Reports![rptOpenLifts].Filter = strSql
Reports![rptOpenLifts].FilterOn = True
Else
Reports![rptOpenLifts].FilterOn = False
End If
Wayne Morgan said:
Gina,
You can have the parameters mentioned by Bob point to the controls on
your form instead of popping up their own input box. This will let you
use a calendar control or some other date picker to make it easier on
the user. It will also allow you to use an input mask on the textbox to
control how the user inputs the date.
As far a "requerying" the report goes, I don't believe that you can (the
Report object has no Requery method). What you can do is open another
copy of the report with the new date parameters.
Another option is to pass the filter to the report when you open it.
Example:
DoCmd.OpenReport "MyReport", acViewPreview,,"[DateField] Between #" &
Me.Filter1 & "# And #" & Me.Filter2 & "#"
You could assign the filter to a variable first if you want and use the
variable instead.
Example:
strSQL = "[DateField] Between #" & Me.Filter1 & "# And #" & Me.Filter2 &
"#"
DoCmd.OpenReport "MyReport", acViewPreview,, strSQL
--
Wayne Morgan
MS Access MVP
Bob,
Like I said I believe I am trying to MAKE the forest for the trees!
I like your way, my only issue is I want the end-user to be able to
requery the report by reselecting parameters (StartDate : EndDate) but
I suppose I can add a requery to a button or something.