?
Solved

Printer options

Posted on 2005-03-10
11
Medium Priority
?
586 Views
Last Modified: 2012-06-27
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.
0
Comment
Question by:kinton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
11 Comments
 
LVL 34

Expert Comment

by:Brian Crowe
ID: 13506028
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
 
LVL 101

Expert Comment

by:mlmcc
ID: 13506190
I have a limited printer options form I built and code to use it if interested.

mlmcc
0
 
LVL 13

Accepted Solution

by:
vidru earned 750 total points
ID: 13506198
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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 2

Author Comment

by:kinton
ID: 13544252
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
 
LVL 2

Author Comment

by:kinton
ID: 13546258
One quick question, what is crxRpt defined as?
0
 
LVL 34

Expert Comment

by:Brian Crowe
ID: 13546437
ReportDocument
0
 
LVL 13

Expert Comment

by:vidru
ID: 13546442
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
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 750 total points
ID: 13550876
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

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question