print multiple copies based on value in text box

109bow

Registered User.
Local time
Today, 08:26
Joined
Oct 24, 2007
Messages
141
Morning all, I'm hoping someone out there can help.
I am trying to print multiple copies of a report called "annual leave" from a button on a form called "annual leave form". I need to be able to print multiple copies of the report based on the value the user enters into a text box which is called "quantity".
I can print a single copy using a macro but have no idea where to start getting it to print multiple copies.
Thanks in advance.
 
Hi

Use this approach

When you print a report manually, you have the opportunity to specify the number of copies in the Print dialog box. Automating the process is simple too — just execute the PrintOut method as follows: DoCmd.PrintOut printrange, pagefrom, pageto, printquality, copies, collatecopies As you can see, the fifth argument is copies; specify the number of copies using this argument. For instance, the following statement opens and prints four copies of a report named Invoices: DoCmd.OpenReport "Invoices", acViewPreview DoCmd.PrintOut , , , , 4 If the report is already open, make sure it's current before printing, as follows: DoCmd.SelectObject acReport, "Invoices", True DoCmd.PrintOut , , , , 4 If you want to print only one copy, you can do so immediately from the OpenReport method by changing acViewPreview to acViewNormal, as follows: DoCmd.OpenReport "Invoices", acViewNormal This statement will send the Invoices report directly to the printer. If users need more flexibility, create a print form that captures page numbers and copy count and pass those values to the report via the OpenReport method.

Taken from
http://www.techrepublic.com/blog/microsoft-office/print-multiple-copies-of-an-access-report/

In your case, just replace the '4' in the string
DoCmd.OpenReport "Invoices", acViewPreview DoCmd.PrintOut , , , , 4
with the value in the textbox Quantity

If you need more detailed guidance, just do a google search for 'print multiple copies of a report'. There's lots of guidance available
 
riddders, thanks for your reply. below is the code I've used;
Private Sub print_Click()
DoCmd.OpenReport "annual_leave_form", acViewPreview, "", "", acNormal
DoCmd.PrintOut acPrintAll, , , , Me.quantity
DoCmd.close acReport, "annual_leave_form"
End Sub
 

Users who are viewing this thread

Back
Top Bottom