ACC97: How to Set Number of Copies for Report w/ PrintOut Method

Last reviewed: January 15, 1998
Article ID: Q179315
The information in this article applies to:
  • Microsoft Access 97

SUMMARY

Moderate: Requires basic macro, coding, and interoperability skills.

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 demonstrates how to use the PrintOut method in a module to set the number of times a report prints.

MORE INFORMATION

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and 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 needs. If you have limited programming experience, you may want to contact the Microsoft fee-based consulting line at (800) 936-5200. For more information about the support options available from Microsoft, please seethe following page on the World Wide Web:

   http://www.microsoft.com/supportnet/refguide/

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 allow you 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.

REFERENCES

For more information about using the PrintOut method, search the Help Index for "PrintOut Method," or ask the Microsoft Access 97 Office Assistant.


Additional query words: duplicate printing more than once
Keywords : kbprint PtrOpt OffVBA PgmPrt
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbhowto


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: January 15, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.