On Thu, 01 Apr 2010 16:52:39 -0600, Marshall Barton
wrote:
You should use the OpenReport method's WhereCondition
argument to specify the filter. That way the report has no
need to be aware of what in on some form.
Another way to have a report prompt the user for criteria before it
runs is to open a form from the report's Open event. Open the form in
Dialog mode so that the report waits for the form to be closed or
hidden before it proceeds. That way you can collect criteria from the
user and build a Where clause for the report. You can also do other
things like hiding and showing detail sections based on the user's
preference.
It also means that you can call the report directly - you don't need
to call it from a form. The benefit is that the selection form is
reusable - it can be called from multiple reports if they need the
same criteria.
I've posted examples of this technique on our free J Street Downloads
page at
http://ow.ly/M58Y
See "Report Selection Techniques".
Armen Stein
Microsoft Access MVP
www.JStreetTech.com