set printer tray

digs

Registered User.
Local time
Today, 19:48
Joined
Aug 16, 2004
Messages
20
I'm in the process of moving over from mdb's to ADP's just setting up my reports in the old mdb i had aa module that printed to a specific tray. Setting this up in ADP can get it to work but once it has run all the toolbars are grayed out and cannot use them can still use buttons on forms to move around. please find code I'm using not sure if its anything to do with ado.
Module
Type zwtDevModeStr
RGB As String * 94
End Type

Type zwtDeviceMode
dmDeviceName As String * 16
dmSpecVersion As Integer
dmDriverVersion As Integer
dmSize As Integer
dmDriverExtra As Integer
dmFields As Long
dmOrientation As Integer
dmPaperSize As Integer
dmPaperlength As Integer
dmPaperWidth As Integer
dmScale As Integer
dmCopies As Integer
dmDefaultSource As Integer
dmPrintQuality As Integer
dmColor As Integer
dmDuplex As Integer
dmResolution As Integer
dmTTOption As Integer
dmCollate As Integer
dmFormName As String * 16
dmPad As Long
dmBits As Long
dmPW As Long
dmDFI As Long
dmDRr As Long
End Type
Sub setPaperSource(rptName As String)
Dim Rpt As Report
Dim dm As zwtDeviceMode
Dim DevString As zwtDevModeStr
Dim DevModeExtra As String

DoCmd.SetWarnings False
' Set Paper Tray for page 1
DoCmd.OpenReport rptName, acDesign
Set Rpt = Reports(rptName)
DevModeExtra = Rpt.PrtDevMode
DevString.RGB = DevModeExtra
LSet dm = DevString
dm.dmDefaultSource = 2 '1 = Upper Tray, 2 = Lower Tray, 5 = _
Envelope Feeder
LSet DevString = dm
Mid$(DevModeExtra, 1, 68) = DevString.RGB
Rpt.PrtDevMode = DevModeExtra
DoCmd.SelectObject acReport, Rpt.Name, True
DoCmd.PrintOut acPages, 1, 2


End Sub

Button Code
DoCmd.Echo False
Call setPaperSource("rp_Contracts")
DoCmd.Echo False
DoCmd.PrintOut copies:=1
DoCmd.Echo False
DoCmd.Close acReport, "rp_contracts"
 

Users who are viewing this thread

Back
Top Bottom