Acc2003: No devicename in PrtDevMode property

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

We are using the PrtDevMode and PrtDevNames property to change
printersettings. This worked fine with Acc97 - 2002. In Acc2003 the
devicename portion of the structur is always empty.

A simple test:

Public Sub bla()
Dim v As Variant

DoCmd.OpenReport "Reportname", acViewDesign
Reports("Reportname").PrtDevMode = "Blasentee"
v = Reports("Reportname").PrtDevMode
Debug.Print v
End Sub

In Acc2000 the variable v is filled with Blasentee in Acc2003 we get nine
characters 0. It's exact the same behaviour if using the full
PrtDevMode-structure instead of Blasentee. The Devicename is always empty.

any idea?
 
H.

What you have found is true, provided the report is set to use the default
printer. If it is set to use a specific printer, then the device name of
the prtdevmode structure is filled.

If the report is set to use the default printer, then the default printer
device name can be obtained in Access 2003 in a different manner. Here's
code that would support that:

Function GetRptPrinterDevice() as String
Dim App as Object
Dim objPrn As Object
Set App = Application
Set objPrn = Application.Printer
GetRptPrinterName = objPrn.DeviceName
Set objPrn = Nothing
Set App = Nothing
End Function
 
Thanks for response.

I thought the error is to find in prtdevmode but further tests shows that
the problem is not only to get and set the devname in prtdevmode, the problem
is to set a specific printer using prtdevmode and prtdevnames for preview.

If set default-bit in prtdevnames to 0 it's not possible in Acc2003 to open
the report in preview mode with the specific printer settings (e.g. with font
for Generic Textonly). The prinout-method works fine.

Looks to me like a bug in Acc2003 same code work with Acc2000. The only
workaround I' ve found is to change the default printer for preview.
 
Back
Top