Printing copies of report without opening it

A

Alu_GK

Hello -
I've seen some of the solution given here to print a report without opening
it in preview.
the solution was

docmd.openreport, acNormal

My problem is - how can I control the number of copies to print with this
command ? in the printout function i have a "copies" parameter. is here i
have no parameter that relate to the number of copies.
Is any one has an idea how to solve it ?
Thanks.
 
W

Wayne-I-M

One method would be to create a text box on your form (called PrintNumber)
then refer to it in the call to print like this OnClick or another event

DoCmd.OpenReport "ReportName", acViewPreview, "", "", acNormal
DoCmd.PrintOut acPrintAll, , , , Me.PrintNumber
DoCmd.Close acReport, "ReportName"

or, if you always want to the same number of reports printed just change the
code to show the number (like this to print 7 copies)
DoCmd.PrintOut acPrintAll, , , , 7
 
A

Alu_GK

Hello -
the solution with the loop is the solotion that will work for me.
the other solution is what i did before, but i don't want to open and
preview the report, it is slow things down in the system.
Thanks for your answer.
and thank you also Wayne-I-M.
 
F

fredg

Hello -
the solution with the loop is the solotion that will work for me.
the other solution is what i did before, but i don't want to open and
preview the report, it is slow things down in the system.
Thanks for your answer.
and thank you also Wayne-I-M.

You can use the SelectObject and PrintOut methods together to print X
copies of the report without opening it in Preview.

DoCmd.SelectObject acReport, "ReportName", True
DoCmd.PrintOut acPrintAll, , , , Forms!FormName!HowMany

where Forms!fFormName!HowMany is the form name and control name that
contains the number of copies you wish printed. If this code is on the
same form as the HowMany control, you can use Me.HowMany instead of
Forms!FormName!HowMany.
 
D

david

Another way is to change the printer setup to
print multiple copies.

There are four ways to change your
printer setup that I think of:

1) Use the printer object
2) Set up a New Printer in windows, and set that
printer to always print N copies.
3) Use the DEVMODE structure.
4) Set up the printer for the report, then save the
report design.

For more information, look at the comments here:
http://toddmcdermid.blogspot.com/2009/02/microsoft-access-2003-and-printer.html

Any of these methods will be much faster than
a report print loop, because they only render the
report once.

You say that if you display the report before printing it,
it slows down the process. Two comments about that:
1) It doesn't slow it down any more than putting one
more copy in a print loop. 2) You can turn off
screen updates while calculating a report for printing.

On error goto catch

Application.Echo False
DoCmd.OpenReport "ReportName", acViewPreview, "", "", acNormal
DoCmd.PrintOut acPrintAll, , , , Me.PrintNumber
DoCmd.Close acReport, "ReportName"
Application.Echo True

Catch:
Application.Echo True
 
A

Alu_GK

Thanks for your answers !!

The way I publish my application is - In a Access runtime 2003 environment,
and MDE file that hides the DB Window
If DBWindow needs to be opened with the SelectObjet Method, and this method
show the DB window, how it will behave under my customers environmet ?
THANKS
 

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