Mulitple instances of a report

G

Guest

I have a form with a listbox listing four groups and a combo box listing
reports to view, so that I can pick the group I want to see the report on
(the listbox value is a parameter in the query the pivot chart form in the
report is based on). I have a command button that will PRINT a series of
reports for these groups using a For...Next iterating the ItemData of the
listbox and DoCmd.OpenReport, however, I would like to be able to PREVIEW the
reports rather than print them. Any thoughts?
 
A

Allen Browne

Ann, this does not work very well in Access.

You cannot open multiple instances of a report with DoCmd.OpenReport.

You can if you use the New keyword, but there are several issues with doing
that. Firstly, you need to store the instances in a collection so as to
manage their lifetime independently of each other. For an example of how to
do that with forms, see:
Managing Multiple Instances of a Form
at:
http://allenbrowne.com/ser-35.html

The next issue is the the New keyword does not allow you to use a
WhereCondition. The obvious workaround is to use the Open event of the
report to apply a filter. Unfortunately, this does not work properly: Access
is likely to not apply any filter, or apply the filter to the wrong
instance. Adding a DoEvents can help, but the results are unreliable. And
this is futher complicated by the fact that Access fails to maintain the
FilterOn property for reports as it does for forms, so you can't really tell
which ones have filters applied and which ones don't. You could try
re-assigning the compete RecordSource for the report instances.

In summary, there is not a simple, reliable way to do what you want, because
of numerous unfixed bugs in Access.
 
J

John Smith

How about using the For loop to build an IN () clause to use as the filter and
then producing all of the groups on one report? You may also need to add a
new page to a group footer so that the print looks the same.

John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top