Printing multiple reports

G

Guest

I have a situation where I am entering data for a purchase order via a Form.
On the form I have a command button that will allow me to print a Report that
contains the data that was entered via the Form. I need to be able to print
two reports - one copy for Accounting and a Customer copy. I have a separate
Report for each copy of the purchase order that I need. I can get the two
versions of the report to print ok, but only the first copy contains data.
The other is blank. The code behind the command button is :

Dim stDocName As String
DoCmd.RunCommand acCmdSaveRecord
stDocName = "Hardcopy PO - Accounting Copy"
DoCmd.OpenReport stDocName, acNormal
stDocName = "Hardcopy PO - Customer Copy"
DoCmd.OpenReport stDocName, acNormal

Is there some code I can add to this to cause data to be included in the
output of both Reports?
 
A

Allen Browne

Your did save the record, and the fact that the first report works shows
that it is in the table. It should therefore work for the second report.

Something else must be wrong. Is the second report reading from the correct
table? Could the criteria in the report's query be incorrect or
misinterpreted? How are you limiting it to just the particular record in the
form?
 
G

Guest

I think the Report side of things is working ok. I have another command
button on my Form that brings up two copies of the reports for review. That
works ok. the code behind that button is:
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "Hardcopy PO - Customer Copy", acViewPreview, ,
"[poheader_ponumber]=" & [ponumber]
DoCmd.OpenReport "Hardcopy PO - Accounting Copy", acViewPreview, ,
"[poheader_ponumber]=" & [ponumber]

This brings up both reports which I can view and select each one
individually for printing. They all contain the same data so it looks like
the reports themselves are ok. I think when I run the print command button
and the first report prints something gets reset before the second report
prints.
 
A

Allen Browne

Well that code looks fine.

Is there anything else happening that could cause an interaction? For
example, are you using the Close event of the report to close the form?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bobk said:
I think the Report side of things is working ok. I have another command
button on my Form that brings up two copies of the reports for review.
That
works ok. the code behind that button is:
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "Hardcopy PO - Customer Copy", acViewPreview, ,
"[poheader_ponumber]=" & [ponumber]
DoCmd.OpenReport "Hardcopy PO - Accounting Copy", acViewPreview, ,
"[poheader_ponumber]=" & [ponumber]

This brings up both reports which I can view and select each one
individually for printing. They all contain the same data so it looks like
the reports themselves are ok. I think when I run the print command button
and the first report prints something gets reset before the second report
prints.


Allen Browne said:
Your did save the record, and the fact that the first report works shows
that it is in the table. It should therefore work for the second report.

Something else must be wrong. Is the second report reading from the
correct
table? Could the criteria in the report's query be incorrect or
misinterpreted? How are you limiting it to just the particular record in
the
form?
 
G

Guest

I got things to work. Your first instincts were right - there was a problem
with my Reports. I found some filter code inserted at the page level of each
report. I took that out and inserted the following code behind my "Print PO -
All Copies" command button.

DoCmd.RunCommand acCmdSaveRecord

DoCmd.OpenReport "Hardcopy PO", acViewNormal, , "[poheader_ponumber]=" &
[ponumber]
DoCmd.OpenReport "Hardcopy PO - Customer Copy", acViewNormal, ,
"[poheader_ponumber]=" & [ponumber]
DoCmd.OpenReport "Hardcopy PO - Accounting Copy", acViewNormal, ,
"[poheader_ponumber]=" & [ponumber]

I added a third copy of the PO to serve as a file copy. This works ok. When
I click the command button I now get my 3 copies tiled as "Customer Copy,
Accounting Copy and a third one for filing all with identical data.

Thanks for the help.



Allen Browne said:
Well that code looks fine.

Is there anything else happening that could cause an interaction? For
example, are you using the Close event of the report to close the form?

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

Bobk said:
I think the Report side of things is working ok. I have another command
button on my Form that brings up two copies of the reports for review.
That
works ok. the code behind that button is:
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenReport "Hardcopy PO - Customer Copy", acViewPreview, ,
"[poheader_ponumber]=" & [ponumber]
DoCmd.OpenReport "Hardcopy PO - Accounting Copy", acViewPreview, ,
"[poheader_ponumber]=" & [ponumber]

This brings up both reports which I can view and select each one
individually for printing. They all contain the same data so it looks like
the reports themselves are ok. I think when I run the print command button
and the first report prints something gets reset before the second report
prints.


Allen Browne said:
Your did save the record, and the fact that the first report works shows
that it is in the table. It should therefore work for the second report.

Something else must be wrong. Is the second report reading from the
correct
table? Could the criteria in the report's query be incorrect or
misinterpreted? How are you limiting it to just the particular record in
the
form?

I have a situation where I am entering data for a purchase order via a
Form.
On the form I have a command button that will allow me to print a
Report
that
contains the data that was entered via the Form. I need to be able to
print
two reports - one copy for Accounting and a Customer copy. I have a
separate
Report for each copy of the purchase order that I need. I can get the
two
versions of the report to print ok, but only the first copy contains
data.
The other is blank. The code behind the command button is :

Dim stDocName As String
DoCmd.RunCommand acCmdSaveRecord
stDocName = "Hardcopy PO - Accounting Copy"
DoCmd.OpenReport stDocName, acNormal
stDocName = "Hardcopy PO - Customer Copy"
DoCmd.OpenReport stDocName, acNormal

Is there some code I can add to this to cause data to be included in
the
output of both Reports?
 

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