How to use code to change a report's printer in Access 2000
- You can change the Windows default printer.
- You can set the PrtDevNames and PrtDevMode properties.
Method 1: Changing the Microsoft Windows default printerIn the Page Setup dialog box, you can select whether forms or reports are printed by either a default printer or a specific printer. If you select a default printer, the form or report is printed to the Windows default printer. If you want to change to another default printer, you must change the Windows default printer.
For additional information, click the following article number to view the article in the Microsoft Knowledge Base:
Method 2: Setting the PrtDevNames and PrtDevMode propertiesThe PrtDevNames property stores the name of the printer, and the PrtDevMode property stores the driver information. You need to change both of these properties in order to change the printer driver. If the PrtDevMode property does not match the PrtDevNames property (that is, the PrtDevMode property describes a different driver than the PrtDevNames property) a General Protection (GP) Fault may occur.
To change the printer driver, you must do the following:
- Open a form or report in Design view.
- Set the PrtDevNames property.
- Retrieve and set the PrtDevMode property.
- Retrieve the information from a previously saved form or report that uses the printer that you want.
- Call the driver and retrieve the structure. In order to call the driver, you need a separate DLL. This is because you must declare calls to functions in outside files ahead of time and the driver name will not be known. Instead, call a DLL that determines the correct printer driver to call and retrieves the DevMode structure.
- Use the Windows Print Common Dialog.
For more information, visit the following Microsoft Web site:
Article ID: 208840 - Last Review: 12/05/2015 10:57:27 - Revision: 2.2
- kbnosurvey kbarchive kbdta kbhowto kbprint KB208840