INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Printer tray selection

How do I get Crystal to select a different printer tray from Visual Basis by mikemer
Posted: 9 Jul 00

This is sample VB code. Modify it to suit your own needs


While Not rsSuppliers.EOF

DoEvents

With Mode
    
    .dmDefaultSource = 1
    .dmFields = &H200

End With

Response% = PEOpenEngine()

strSQL = ""
strSQL = "isnull({Beneficiaries.dt_Date_of_Update}) and isnull({Suppliers.dt_date_of_update}) and {Suppliers.c_Practice_Number} = '" & Trim(rsSuppliers!c_Practice_Number) & "' and {Member_Statement.c_Recipient_of_Payment} = 'S'"

Job% = PEOpenPrintJob("C:\Program Files\Seagate Software\Crystal Reports\Supplier Claims.rpt")

Response% = PESetSelectionFormula(Job%, strSQL)

Response% = PEOutputToPrinter(Job%, 1)

Response% = PEGetNPages(Job%) ' How many pages in report

Pages% = Response%

If Pages% <> 0 Then

Counter = Counter + 1

If Pages% = 1 Then

Mode.dmDefaultSource = 2 ' Lower tray

Response% = crPESelectPrinter(Job%, Printer.driverName, Printer.DeviceName, Printer.Port, Mode)

Response% = PEStartPrintJob(Job%, 1)

Else

Mode.dmDefaultSource = 1  ' Upper Tray

Response% = crPESelectPrinter(Job%, Printer.driverName, Printer.DeviceName, Printer.Port, Mode)

With Options

    .collation = PE_UNCOLLATED
    .nReportCopies = 1
    .StructSize = PE_SIZEOF_PRINT_OPTIONS
    .StartPageN = 1
    .stopPageN = Pages% - 1

End With

Response% = PESetPrintOptions(Job%, Options)

Response% = PEStartPrintJob(Job%, 1)

Mode.dmDefaultSource = 2 ' Lower tray

Response% = crPESelectPrinter(Job%, Printer.driverName, Printer.DeviceName, Printer.Port, Mode)

With Options

    .collation = PE_UNCOLLATED
    .nReportCopies = 1
    .StructSize = PE_SIZEOF_PRINT_OPTIONS
    .StartPageN = Pages%
    .stopPageN = Pages%

End With
This a sample of VB code that can be modified to suit your needs.

Response% = PESetPrintOptions(Job%, Options)

Response% = PEStartPrintJob(Job%, 1)

End If

Response% = PEClosePrintJob(Job%)

End If

rsSuppliers.MoveNext

Wend

rsSuppliers.Close

Back to Business Objects: Crystal Reports 4 Other topics FAQ Index
Back to Business Objects: Crystal Reports 4 Other topics Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close