Microsoft KB Archive/287473

= ACC2002: Run-Time Error Message When You Programmatically Set PaperSize Property =

Article ID: 287473

Article Last Modified on 10/11/2006

-

APPLIES TO


 * Microsoft Access 2002 Standard Edition

-



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: \MSACCESS.EXE

abnormal program termination

where  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 &quot;Symptoms&quot; 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.

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

Notice that Access quits unexpectedly.</li></ol>

Additional query words: pra

Keywords: kbbug kberrmsg KB287473

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.