Exporting multiple reports via macro

M

Mike

Steve Schapel gave the following response to a question on how to run muliple
reports:

"Doing this with a macro probably needs to involve:
- make a continuous view form with your list of names
- make a macro to...
- export a report for the name of the current record on the form
- use GoToRecord action to move to the next record on the form
- make another macro using the RunMacro action, to run the export
macro, with a suitable Repeat Expression argument, so the export is run
for each name."

I followed this advice to produce reports based on work unit code numbers.
It was fine for a test of 6 work units but when I loaded the other 30 work
units the output did not match the data for the particular unit.

Someone told me Access does not necessarily read the table in the order it
was created in [and something about memory that I did not understand]. I was
also advised it wld be better not to use a form and instead create a query
that filtered the data and had the macro point to that query.

I am open to suggestions.

Mike
 
S

Steve Schapel

Mike,

It is true that the data in tables is un-ordered. It is true that in
order to control the order of records in a data set, you need to
explicitly sort the records as required, and yes, this is a job for a
query. And then, if you use the query as the Record Source of a form,
then the records as displayed on the form will be ordered as required.

However, none of this is really relevant to the method of outputting the
reports that I wrote about. The report produced should always be
related to the current record on the form, regardless of what the
current record might be. So the order of the records on the form will
affect the order of the reports, but should not affect the matching of
the data. So something else in amiss here.

And by the way, you can't do this same approach by directly referencing
a query, as it is not possible to reference the query's "current" record.

Hope that helps. Please post back with more detailed explanation of the
problem you experienced, with examples, if you need more explicit help.

I should also mention that there are other ways of doing this, by
looping through a Recordset within a VBA procedure... but that's another
topic.
 

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