Notice: This website is an unofficial Microsoft Knowledge Base (hereinafter KB) archive and is intended to provide a reliable access to deleted content from Microsoft KB. All KB articles are owned by Microsoft Corporation. Read full disclaimer for more details.

ACC2000: Setting Number of Copies for Report with PrintOut Method


View products that this article applies to.

This article was previously published under Q200548
Moderate: Requires basic macro, coding, and interoperability skills.

↑ Back to the top


Summary

At times, you may want to set the number of copies that print for a report without opening the Printer dialog box. You can do so by using the PrintOut method or action. This article shows you how to use the PrintOut method in a module to set the number of times a report prints.

↑ Back to the top


More information

Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. You can use the PrintOut action or method to print the active object in the open database. You can print datasheets, reports, forms, and modules. The following steps show you how to open the Catalog report in the Northwind.mdb database and print a specified number of copies of the report.
  1. In Microsoft Access, open the sample database Northwind.mdb.
  2. Create a new form in Design view and add a command button to the form.
  3. Set the OnClick property of the command button to the following event procedure:
    Private Sub Command0_Click()
    
       DoCmd.Echo False
       ' Open the report in Preview mode.
       DoCmd.OpenReport "Catalog", acViewPreview
       ' Print two copies of page 1 of report.
       DoCmd.PrintOut acPages, 1, 1, , 2
       DoCmd.Close       ' Close the report.
       DoCmd.Echo True
    
    End Sub
    					
  4. To test this procedure, open the form in Form view and click the command button.

    Note that the report is printed twice and the form is then closed.

↑ Back to the top


References

For more information about the PrintOut method, in the Visual Basic Editor, click Microsoft Visual Basic Help on the Help menu, type printout method in the Office Assistant or the Answer Wizard, and then click Search to view the topic.

↑ Back to the top


Keywords: KB200548, kbprint, kbhowto

↑ Back to the top

Article Info
Article ID : 200548
Revision : 2
Created on : 6/23/2005
Published on : 6/23/2005
Exists online : False
Views : 211