Microsoft KB Archive/140286

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

Article ID: 140286

Article Last Modified on 9/7/2001

-

APPLIES TO


 * Microsoft Access 2.0 Standard Edition

-



This article was previously published under Q140286



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

