[AccessD] PRTDEVMODE a request to check code.....

Tom Keatley tom at piedpiper.com.au
Thu Jan 30 18:52:00 CST 2003


Hi all...

I have made posts over the last few days ALL concerning Access reports
slipping into LETTERSIZE when they should be A4. You guys have made various
suggestions (thanks) mostly concerning the use of the PRTDEVMODE property.

The problem is ....I have been using that for some time ....I am migrating
this database from Win95 to Win2000 and the problem didnt appear to be there
in Win95. I send single page reports at the rate of one every couple of
seconds and there could be a hundred reports in a single session. The
problem of slipping into lettersize may happen on the 1st or the 50th.

Desperation is beginning to creep in as I am starting to feel I will never
solve this one and I will have to stick with Win95 with this DB

I would really appreciate it if someone could have a look at the code I am
using to see if there are any possible problems that could cause this
occasional dropout......please find code below

Thanks in advance

Regards

Tom Keatley

Option Compare Database
Option Explicit

' Code for PrtDevMode property.
==========================================
Type str_DEVMODE
    RGB As String * 94
End Type

Type type_DEVMODE
    strDeviceName As String * 16
    intSpecVersion As Integer
    intDriverVersion As Integer
    intSize As Integer
    intDriverExtra As Integer
    lngFields As Long
    intOrientation As Integer
    intPaperSize As Integer
    intPaperLength As Integer
    intPaperWidth As Integer
    intScale As Integer
    intCopies As Integer
    intDefaultSource As Integer
    intPrintQuality As Integer
    intColor As Integer
    intDuplex As Integer
    intResolution As Integer
    intTTOption As Integer
    intCollate As Integer
    strFormName As String * 16
    lngPad As Long
    lngBits As Long
    lngPW As Long
    lngPH As Long
    lngDFI As Long
    lngDFr As Long
End Type


Sub chgDEvmode(ByVal strReportName As String, ByVal intCopies As Integer )
    Dim DevString As str_DEVMODE
    Dim DM As type_DEVMODE
    Dim strDevModeExtra As String
    Dim rpt As Report

    Echo (False)
    DoCmd.OpenReport strReportName, acDesign

    Set rpt = Reports(strReportName)

    If Not IsNull(rpt.PrtDevMode) Then
        strDevModeExtra = rpt.PrtDevMode
        DevString.RGB = strDevModeExtra
        LSet DM = DevString
        DM.intPaperSize = 9 'intUserPaperSize
        DM.intCopies = intCopies
        DM.lngFields = DM.lngFields Or DM.intPaperSize Or DM.intCopies
        LSet DevString = DM
        Mid(strDevModeExtra, 1, 94) = DevString.RGB
        rpt.PrtDevMode = strDevModeExtra
    End If
    DoCmd.Close acReport, strReportName, acSaveYes
    Echo (True)
    Set rpt = Nothing
End Sub




More information about the AccessD mailing list