ACC2: PrtDevMode Settings Do Not Work Under Windows 95 or Later

ID: Q140286


The information in this article applies to:


SYMPTOMS

Advanced: Requires expert coding, interoperability, and multiuser skills.

When you run Microsoft Access version 2.0 under Windows 95 or later, a database that uses an Access Basic procedure to set a form or report's PrtDevMode property doesn't change the Print Setup settings correctly. The same procedure works correctly when you run Microsoft Access 2.0 under Windows 3.x.


CAUSE

The PrtDevMode property mirrors the Windows DEVMODE structure. This structure has changed in Windows 95 and later.

Part of the process of changing a form or report's PrtDevMode property is to store the current PrtDevMode structure in a string variable. An application can use the zwtDevModeStr type defined in the WZFRMRPT wizard library if this library is being loaded. If the library is not being loaded, as is the case with a run-time application, a common alternative is to copy this type declaration from the Wizard module to the Declarations section of one of the application's modules.

The string element RGB in this structure is defined as 64 bytes. The new DEVMODE structure requires this string to be larger.


RESOLUTION

If your application does not contain this type declaration, include a new type declaration and change the references to the old structure. If your application already has this type declaration, change the size of the string element.


MORE INFORMATION

If your application does not define this structure in the Declarations section of a module (you are using the wizard declaration), you need to add the type declaration to one of your application's modules. To do so, add the following lines to the Declarations section of one of your application's modules. This must be a stand-alone module.


   Type str_DEVMODE

       RGB As String * 512

   End Type 

Replace all references to the old type structure zwtDevModeStr in your application code to the new type structure, str_DEVMODE.

If the Declarations section of one of the modules in your application already contains this type declaration, change the line that reads

   RGB As String * 64

to read:

   RGB As String * 512 


REFERENCES

For more information about using PrtDevMode, please see the following articles in the Microsoft Knowledge Base:

Q129397 ACC: How to Change a Report's Printer Using Code

Q129748 ACC: Using the PrtDevMode Property to Verify Custom Page Size

Q129722 ACC2: Using the PrtDevMode Property to Change Page Orientation

For more information about the PrtDevMode Property, search for "PrtDevMode," and then "PrtDevMode" topic using the Microsoft Access Help menu.


Keywords          : kbprint PtrSetup 
Version           : 2.0
Platform          : WINDOWS 
Issue type        : kbprb 

Last Reviewed: March 24, 1999