Printer options

I wasn't sure whether to put this under Crystal or VB, so if you think it is more of a VB question please say and i'll re-post it there or request it be moved....


We are using the crystal viewer in a VB and VBA environment. Our report appears within the crystal viewer without problem. However, we have need to print the report to different printers AND to specify the printer tray.
However, when you click the print icon, Crystal picks up the default printer and not only does not allow you to select a different printer but also does not allow you to select a tray for the printer in question.

Is there away to get the printer options box to display instead of directly printing using all of the defaults?

Any help would be much appreciated.
LVL 2
kintonAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brian CroweDatabase AdministratorCommented:
If you are printing through an app then don't allow the crystal viewer to display the print button.  Instead provide your own printing functionality.  I've done this exact thing but in VB.Net so I'm hoping it translates.  Display your own printdialog and then copy the printersettings from the printdialog to your reportdocument's printsettings.  You can also override the papersource (there may be some issues if your printer is an HP but that's a separate discussion)
0
mlmccCommented:
I have a limited printer options form I built and code to use it if interested.

mlmcc
0
vidruCommented:
The CRViewer has a PrintButtonClicked event.  You can use the Report object's PrinterSetup method to invoke a dialog that allows the user to pick a printer/tray, etc.  This might be overkill, but this is a common example of what I put in the PrintButtonClicked event:

Private Sub Viewer_PrintButtonClicked(UseDefault As Boolean)
    'Get the report's current orientation and paper size
    'CRPaperOrientation and CRPaperSize are Enumerated type _
        members of the CRAXDRT library
    Dim cOrientation As CRPaperOrientation
    Dim cSize As CRPaperSize
    cOrientation = crxRpt.PaperOrientation
    cSize = crxRpt.PaperSize
   
    'Call the Printer Setup dialog
    crxRpt.PrinterSetupEx Me.hwnd

    'Loop through the Printers collection to ensure the correct _
        printer gets set for the report
    Dim p As Printer
    For Each p In Printers
        If p.DeviceName = crxRpt.PrinterName Then
            crxRpt.SelectPrinter p.DriverName, p.DeviceName, p.Port
            Exit For
        End If
    Next p

    'Reset the report's PaperOrientation and PaperSize properties _
        to override the "new" printer's defaults
    crxRpt.PaperOrientation = cOrientation
    crxRpt.PaperSize = cSize
End Sub

-dave
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

kintonAuthor Commented:
Thanks for your replies - got sidetracked with something else, sorry!

I wouldnt mind having a look at your code mlmcc - even if I don't use it in this instance it may be handy for some other printing issues we'll soon be attempting to implement.


Thanks for your code vidru.  I'm going to give this a go - hopefully soon, once i've got a report im doing out of the way.  I wont forget the post, it just might take me a few days.

0
kintonAuthor Commented:
One quick question, what is crxRpt defined as?
0
Brian CroweDatabase AdministratorCommented:
ReportDocument
0
vidruCommented:
That's the report object.  In the General Declarations section of the form module where the report will be printed, I usually declare the Application and Report objects there:

Dim crxApp As New CRAXDRT.Application
Dim crxRpt As CRAXDRT.Report

Private Sub Form_Load()
  Set crxRpt = crxApp.OpenReport("Report1.rpt")

  etc.......

-dave
0
mlmccCommented:
Look here for - form_printer_setup.frm

http://groups.msn.com/McCrackenUNO/files.msnw?fc_p=%2FExperts%20Exchange%20Files&fc_a=0

You may have to create an msn passport.  If you can't get to it let me know and I'll try to post it elsewhere.

mlmcc
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Crystal Reports

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.