Question
I have made a form in an Access Database. I created a button to print the results of the form. My problem is that I want to print this page 9 times. Is there any way to press the print button and print what I need 9 times or do I have to press the button 9 times every time. Thanks in advance.
Answer
Microsoft Access 2003 or earlier
To enable printing multiple copies of a form you will need to add a bit of code to the code that is already on the print button:
To view the code right click on the print button, select 'Properties', click on the 'Event' tab and place your cursor next to 'On Click' then click on the '...' button that should now appear.
Your code will look similar to below.
******
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click
DoCmd.PrintOut
Exit_Command18_Click:
Exit Sub
Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click
End Sub
******
What you need to do is run the DoCmd.PrintOut X 9 times.
Therefore change your code to the following:
******
Private Sub Command18_Click()
On Error GoTo Err_Command18_Click
Dim i as integer
For i 1 to 9
DoCmd.PrintOut
Next i
Exit_Command18_Click:
Exit Sub
Err_Command18_Click:
MsgBox Err.Description
Resume Exit_Command18_Click
End Sub
******
This will print your form 9 times.
If this is your first tast of coding (VBA) and you would like to learn more then Click Here
Microsoft Access 2007 or Later
From Microsoft Access 2007 and later, code was not added automatically to buttons etc, after following a wizard, Embedded Macros were. So the process for printing mulitple copies of a form is a bit different for the latter versions.
To view the embedded macro, right click on the print button, select 'Properties', click on the 'Event' tab and place your cursor next to 'On Click' then click on the '...' button that should now appear.
The Macro window will open. You will see a drop down list with 'Add New Action' and a green cross next to it. Click on this dropdown list and select 'Print Object'.
Repeat 7 more times (you have already done 2).
This will print your form 9 times, thus the answer to printing multiple copies.