Help and Support
 

powered byLive Search

How to use code to change a report's printer in Access 2000

Article ID:208840
Last Review:August 17, 2007
Revision:2.2
This article was previously published under Q208840
Advanced: Requires expert coding, interoperability, and multiuser skills.

On This Page

SUMMARY

You can change the printer for a report or form in two ways:
You can change the Windows default printer.
You can set the PrtDevNames and PrtDevMode properties.
The information in this article supplements the Microsoft Access Help topic about the PrtDevNames property.

Back to the top

MORE INFORMATION

Method 1: Changing the Microsoft Windows default printer

In 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:
246772 (http://support.microsoft.com/kb/246772/) HOWTO: Retrieve and Set the Default Printer in Windows

Back to the top

Method 2: Setting the PrtDevNames and PrtDevMode properties

The 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:
1. Open a form or report in Design view.
2. Set the PrtDevNames property.
3. Retrieve and set the PrtDevMode property.
In order to set the PrtDevMode property to the appropriate structure, you must obtain the driver information. You can obtain this information in several ways:
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.

Back to the top

REFERENCES

For more information about the PrtDevMode and the PrtDevNames properties, click Microsoft Access Help on the Help menu, type PrtDevMode, PrtDevNames in the Office Assistant or the Answer Wizard, and then click Search to view the topic.
For more information, visit the following Microsoft Web site:
http://msdn2.microsoft.com/en-us/library/Aa207072(office.10).aspx (http://msdn2.microsoft.com/en-us/library/Aa207072(office.10).aspx)

Back to the top


APPLIES TO
Microsoft Access 2000 Standard Edition

Back to the top

Keywords: 
kbdta kbhowto kbprint KB208840

Back to the top

Article Translations

 

Related Support Centers

Other Support Options

  • Need More Help?
    Contact a Support professional by Email, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.