ACC2002: Run-Time Error Message When You Programmatically Set PaperSize Property (287473)



The information in this article applies to:

  • Microsoft Access 2002

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

This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).

SYMPTOMS

In Microsoft Access, when you use Microsoft Visual Basic for Applications (VBA) code to set the PaperSize property of a Generic / Text Only printer to acPRPSDSheet or acPRPSESheet while the report is open in Preview, you may receive the following error message
Runtime Error!

Program: path\MSACCESS.EXE


abnormal program termination
where path is the directory path to Microsoft Access on your computer -- for example, C:\Program Files\Microsoft Office\Office10.

CAUSE

This behavior occurs because the Generic / Text Only printer driver does not support D-size and E-size sheets.

RESOLUTION

To resolve this issue, select a printer driver that supports the paper size that you want to use.

STATUS

Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article.

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. The Generic / Text Only printer driver does not support large paper sizes. This behavior may not occur when other printers are selected and does not occur unless the report is open in Preview while an unsupported PaperSize property is assigned in code. If an unsupported paper size is assigned before the report is opened, you receive the following error message instead of the run-time error message described in the "Symptoms" section of this article:
Microsoft Access can't print or print preview the page because the paper size you selected is larger than 22.75 inches.

Steps to Reproduce the Problem

CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.

  1. If it is not already installed, install a Generic / Text Only printer and select it as the default printer.
  2. Start Access and open the sample database Northwind.mdb.
  3. In the Database window, click Reports, select Customer Labels, and then click Preview.
  4. Press ALT+F11 to open the Visual Basic Editor.
  5. Press CTRL+G to open the Immediate window, type the following line of code, and then press ENTER:
    Reports(0).Printer.PaperSize = acPRPSDSheet
    					
  6. When you receive the run-time error message described in the "Symptoms" section, click OK.

    Notice that Access quits unexpectedly.

Modification Type:MinorLast Reviewed:10/11/2006
Keywords:kbbug kberrmsg KB287473