Passing data to a report and printing more than one copy

R

rsosabusiness

Access 2000 - In a tiny dabatase that is used for reconciling busines
accounts I discovered two reports that are identical in evey detail,
execpt the names of the controls. The data is of the same type but for
two different periods. The reason for the different control names and
for two separate reports it that the reports are printed from two
different forms: one prints the current batch and YTD data and the
other prints the batch totals and YTD totals for a previous batch (for
a special request or if the printers are not available when a batch is
processed). Each report refer to the associated form name to pick up
the numbers from the controls in the forms. I thought it would be
better to only one report and have the two forms use the same control
names. The report would refer to screen.activeform. That works well
except that printing the report from preview mode shows 'error' in all
fields, but the data shows correctly if printing the report without
preview. I'm asuming that's because in the preview mode the
screen.activeform may be the report itself, I don't know. My expertise
is very limited. Given all that, is there a way I can pass the data to
the report in a way that allows a preview? And how can I get the report
to print more than one copy?
Thanks for your help!
Robert
 
J

Jeff Boyce

Reports are based on queries (or tables). From your description, it sounds
like there may be a chance that the two reports are based on different
queries. Or perhaps in switching them over to use the same report to gather
values, a reference was mistyped or missed...

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 
R

rsosabusiness

Jeff said:
Reports are based on queries (or tables). From your description, it sounds
like there may be a chance that the two reports are based on different
queries. Or perhaps in switching them over to use the same report to gather
values, a reference was mistyped or missed...

--
Jeff,
Thanks for the prompt response. You are correct in that both reports
use the same query to collect the YTD data. Only the filter changes for
each form. One (current batch) collects all of the data in the
corresponding table, including that entered in the batch processing.
The other (previous batch) collects the data up to the date of the
selected batch. The batch data itself is collected from the form
invoking the report. As I said, the data displays correctly in review
mode, but when the report is actually printed it shows the YTD
correctly, but shows 'error' in each field from the batch summary
record. The data print correctly when the report is opened in normal
mode. I think the problem comes from using Screen.Active form, but I do
not know the cure, except passing the data to the report perhaps from a
module, but I do not know how to do that. And there is the separate
question of how to print more than one copy regardless of the report
mode.
Again, thanks for your interest and your thoughts.
Robert
 
R

rsosabusiness

Jeff said:
There's no need to "pass" data to the report. If you have a form that holds
the data you need (including selection criteria), you could use controls in
the report that look to the form for their values.

Jeff,
Recall that the report is invoked from 2 different forms. That's why I
ended up using screen.activeform to pick up the data. If I try to
preview the report and then print it, I get the errors. If I print the
report immediately, there are no errors. That's fine with me, except
that to print two copies I have to execute the docmd.openreport twice,
when it seems to me there should be a way to specifiy how many copies I
want to print. The Docmd.openreport has no argument for that.
DoCmd.PrintOut does, but I do not see how I can point to the report in
that command. So my problem is now reduced to: how can I specify number
of copies I want to print? You can see that my knowledge is quite
limited.
Cordially,
Robert
 
J

Jeff Boyce

Mine, too! I haven't had the occasion to need multiple copies of a report.
Perhaps one of the other newsgroup readers will offer a suggestion on that
issue. Or you could consider posting the "reports"-related question to the
reports newsgroup for more ideas.

Rather than using the screen.activeform, you might be able to refer
specifically to the form(s) that hold the information your report needs.

If you have a query that needs criteria from one/more forms, you could refer
to the controls with something like:

Forms!YourFormName!YourControlName

You could also use this directly in a report, if the form value is not
needed as a query criterion.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 

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