[?] Subscribe To This Site

XML RSS
Add to Google
Add to My Yahoo!
Add to My MSN
Subscribe with Bloglines


Home
Whats New!
Need a database?
Tips via email
Learn VBA
Questions Answered
Access Tips Index
What is MS Access

Printing Multiple Copies

 

Printing Multiple Copies

 

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

 

To do what you ask 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.

 

Do you like this tip? Subscribe to my Newsletter to receive tips via email. Click Here to subscribe.

 

www.simply-access.com (c) 2002 - 2009