Results 1 to 4 of 4

Thread: Crystal Reports RDC / Allow User to Select Printer

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jun 2002
    Location
    Sunny Scottsdale Arizona
    Posts
    254

    Angry Crystal Reports RDC / Allow User to Select Printer

    I need to know how to allow the user to select a printer when printing Crystal reports as opposed to just sending to the default printer.

    I am currently designing my reports using RDC. I have a single form (frmRptView), with only the CRViewer control, which I call to view all of my reports.

    Here is the code I am using to view a report:

    Private Sub cmdViewReport_Click()

    Dim Report As New NameOfReport

    With frmRptView
    .CRViewer1.ReportSource = Report
    .Show
    .CRViewer1.ViewReport
    End With

    End Sub

    Now I am looking to find the code to utilize under the CRViewer1_PrintButtonClicked event procedure to allow the user to select printer. Under Crystal Care Technical Support I found the following code:

    Private Sub CRViewer1_PrintButtonClicked(UseDefault As Boolean)

    'Do not use the default printer dialog
    UseDefault = False

    'Display the Windows Standard Printer Setup dialog box.
    Report.PrinterSetup Form1.hWnd

    'Print the report without displaying the default printer dialog.
    'If the option to set the number of pages is required then
    'pass a value of True.
    Report.PrintOut False

    End Sub

    Problems:

    1> In my form (with the CRViewer1 control), it does not recognize Report as object.

    2> If I hardcode in the name of the report it asks me to enter parameter values. I should mention this is a paramaterized report.

    So first things first, If someone could tell me how I can refer to the report from the form which I view the report that would be a start.

  2. #2
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384
    When using the crystal viewer:
    Code:
    Private Sub CRViewer_PrintButtonClicked(UseDefault As Boolean)
    
        UseDefault = False
        CReport.PrinterSetup Me.hwnd
        CReport.PrintOut True
        Set CReport = Nothing
        CRViewer.Visible = False
        
    End Sub
    Mel

  3. #3
    Frenzied Member
    Join Date
    Nov 2001
    Posts
    1,384
    Set Report.PrintOut False = True, to show the user the dialog box in order to choose a printer.
    Mel

  4. #4
    Registered User
    Join Date
    Aug 2020
    Posts
    1

    Re: Crystal Reports RDC / Allow User to Select Printer

    Quote Originally Posted by mel_flynn View Post
    When using the crystal viewer:
    Code:
    Private Sub CRViewer_PrintButtonClicked(UseDefault As Boolean)
    
        UseDefault = False
        CReport.PrinterSetup Me.hwnd
        CReport.PrintOut True
        Set CReport = Nothing
        CRViewer.Visible = False
        
    End Sub
    Can you further explain where to define CReport ..

    I have a form in vb project i.e. Report which hold crviewer and I use to call this from from any other reporting form. .. i.e. create object of this and pass parameters ... now how to to this ???

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width