Printing to Different Trays

donbettis

Old User Gone Astray
Local time
Today, 16:43
Joined
Jan 23, 2001
Messages
103
I have reports of two different types…

One type can be printed on plan paper (Tray #1)…

The other needs to be printed on letterhead (Tray #2)…

I know how to do this in the properties of the printer; and in the page setup on each report however, in the long run I think it would be better doing this with code...

My question is this…

How would the code be written to print the reports to their respective trays?


Don
 
You can set a specific printer for a specific report, I only have one printer attached to my PC at the moment so can't test for you.
See attached pic.
 

Attachments

  • tmppagesetup.gif
    tmppagesetup.gif
    44 KB · Views: 209
Re-read your question - maybe you can specify the tray in the print options as per above?
 
Fornatian:

Thanks for your reply…

However; I was aware of how to print to different trays using the page setup for each report, what I am looking for is a way of doing this with code instead...

Thx

Don :p
 
Either of these any help?
Sub SetReportTray(r As Report, traynumber As Integer)
'
' Changes the tray number of a report that is opened in DESIGN mode
'
Dim DM As str_DEVMODE 'R_DevModeStr
Dim DevMode As type_DEVMODE
'MsgBox "test"
If Not IsNull(r.PrtDevMode) Then
DM.RGB = r.PrtDevMode
LSet DevMode = DM
DevMode.intDefaultSource = traynumber
LSet DM = DevMode
r.PrtDevMode = DM.RGB
End If
End Sub

Function TwoTrayPrinting(ReportName As String) As Integer
'
' Prints a report's page 1 from the upper tray
' and the remaining pages from the lower tray.
' NOTE: The report gets run twice, once for each tray.
'
' Assumes: that the report has 999 or fewer pages.
'
' Returns: TRUE = Success; FALSE = Error
'
Const MAX_PAGES = 999

' Open the report in DESIGN view
On Error GoTo TTP_Error
DoCmd.Echo False
DoCmd.OpenReport ReportName, A_DESIGN

' Switch to upper tray and print first page
SetReportTray Reports(ReportName), R_UPPER_TRAY
DoCmd.PrintOut A_PAGES, 1, 1

' Switch to lower tray and print remaining pages
SetReportTray Reports(ReportName), R_LOWER_TRAY
DoCmd.PrintOut A_PAGES, 2, MAX_PAGES

' Close the report
DoCmd.SetWarnings False
DoCmd.Close A_REPORT, ReportName
DoCmd.SetWarnings True
DoCmd.Echo True
'TwoTrayPrinting = True

TTP_Exit:
Exit Function

TTP_Error:
' TwoTrayPrinting = False
DoCmd.Echo False ' Restore screen echo
Resume TTP_Exit

End Function
 
Rich:

Thanks for your reply...I'll give it a try.

Don

***Edited because of a typo :D
 

Users who are viewing this thread

Back
Top Bottom