?
Solved

Crystal Reports in VB - Crystal Report Control

Posted on 2003-03-25
14
Medium Priority
?
1,505 Views
Last Modified: 2012-06-21
How do I set the report to print multiple pages/copies?
Seams logical the CopiesToPrinter property would do it but this isn't true.
0
Comment
Question by:adamkushner
[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
  • 5
  • 3
  • 2
  • +3
14 Comments
 
LVL 2

Expert Comment

by:JoaTex
ID: 8206752
Hi

You can select directly on your crystal report number of copies or before your code line  to print put

CrystalReport1.Printercopies = 3
crystalReport1.PrintReport

Jo
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8207239
Depends on the method you are using to call the report?

RDC, ActiveX, OCX, Print Engine?

mlmcc
0
 

Author Comment

by:adamkushner
ID: 8210065
  CR1.PrinterCopies = 3 - does not work

Here's my code:

        CR1.ParameterFields(0) = "invoicenumber;" & invoicenumber & ";True;"
        CR1.DataFiles(0) = SwedishDatabaseLocation
        CR1.ReportFileName = App.Path & "\creport1.rpt"
        CR1.WindowTitle = "SMManager - Invoice #" & invoicenumber
        CR1.PrinterCopies = 3
        'This does not work
        CR1.PrintReport
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Expert Comment

by:joaquimbie
ID: 8210397
to print many copies I think is not possible because you can not determinie the number of copies that the user want.

but send one to window and let the user determinie the number that he want try the code:

crystalreport1.datafiles(0)= LocationAndNameOfDatabase
crystalreport1.reportfilename=app.path & "\Report.rpt"
crystalreport1.printercopies=1
crystalreport.destination=crptToPrinter or crptToWindow
crystalreport1.action=1
0
 

Expert Comment

by:joaquimbie
ID: 8210399
to print many copies I think is not possible because you can not determinie the number of copies that the user want.

but send one to window and let the user determinie the number that he want try the code:

crystalreport1.datafiles(0)= LocationAndNameOfDatabase
crystalreport1.reportfilename=app.path & "\Report.rpt"
crystalreport1.printercopies=1
crystalreport1.destination=crptToPrinter or crptToWindow
crystalreport1.action=1
0
 

Author Comment

by:adamkushner
ID: 8210590
Definitley Not what I'm looking for. Not 2 print windows.  1 window with copies to print set at 2.
0
 

Author Comment

by:adamkushner
ID: 8217638
Anyone object to closing this question?
I cannot find a solution. . .
0
 
LVL 101

Accepted Solution

by:
mlmcc earned 200 total points
ID: 8217902
CopiesToPrinter works for me.  Here is the code


This is on our MDI form but it could be on any form.  Uses the Crystal OCX.  frm_Printer_Setup is a form I built to allow the user to change some things or cancel a print.

Public WithEvents cr_Generic_Report As CrystalReport


Public Sub print_Report_from_View(Txt_Report_File_Name As String, _
                            txt_Record_Selection_Formula As String)

    frm_Printer_Setup.Show MODAL

    If (frm_Printer_Setup.lbl_Button_Selected = "Print") Then
        cr_Generic_Report.ReportFileName = Txt_Report_File_Name
        cr_Generic_Report.ReplaceSelectionFormula txt_Record_Selection_Formula
        If (frm_Printer_Setup.opt_Pages) Then
            cr_Generic_Report.PrinterStartPage = frm_Printer_Setup.txt_Start_Page
            cr_Generic_Report.PrinterStopPage = frm_Printer_Setup.txt_Stop_Page
        End If
        cr_Generic_Report.Destination = crptToPrinter
        cr_Generic_Report.PrinterName = frm_Printer_Setup.cbo_Prtr_Name
        cr_Generic_Report.CopiesToPrinter = frm_Printer_Setup.txt_Copies
        cr_Generic_Report.Action = 1
    End If

    Unload frm_Printer_Setup
    Set frm_Printer_Setup = Nothing
    cr_Generic_Report.Reset
       
End Sub

mlmcc
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8217917
Here is how I do it using the RDC

Option Explicit
    Dim crApp As CRAXDRT.Application
    Dim crRpt As CRAXDRT.Report

Public Sub crPrint_Report(txtReportName As String, _
                                        txtSelectClause As String)
On Error GoTo errHandler
    Dim i As Integer
    Dim intCopies As Integer
    Dim intStartPage As Integer
    Dim intStopPage As Integer

    frmPrinterSetup.Show MODAL
    If (frmPrinterSetup.lblButtonSelected = "Print") Then
'
'   Check if report is already in use
'
        If IsObject(crRpt) Then
           Set crRpt = Nothing
        End If

'
'   Open report
'
        Set crApp = New CRAXDRT.Application

        Set crRpt = crApp.OpenReport(txtReportName, 1)
        crRpt.RecordSelectionFormula = txtSelectClause

'
'   Set flags for CRViewer
'
        crRpt.MorePrintEngineErrorMessages = False
        crRpt.EnableParameterPrompting = False
        crRpt.DiscardSavedData

'
'   Print Report
'
        intCopies = frmPrinterSetup.txtCopies
        If (frmPrinterSetup.optPages) Then
            intStartPage = frmPrinterSetup.txtStartPage
            intStopPage = frmPrinterSetup.txtStopPage
            crRpt.DisplayProgressDialog = False
            crRpt.PrintOut False, intCopies, , intStartPage, intStopPage
        Else
            crRpt.DisplayProgressDialog = False
            crRpt.PrintOut False, intCopies
        End If
    End If
    Unload frmPrinterSetup
    Unload Me

    Exit Sub

errHandler:
    Resume Next

End Sub

mlmcc
0
 

Expert Comment

by:CleanupPing
ID: 8899894
adamkushner:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
Experts: Post your closing recommendations!  Who deserves points here?
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 8906542
Depending on the method used to call the report one of my code segments should work.

mlmcc
0
 

Expert Comment

by:CleanupPing
ID: 9056252
adamkushner:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 101

Expert Comment

by:mlmcc
ID: 9061385
I believe I provided the answer.

mlmcc
0
 
LVL 6

Expert Comment

by:GPrentice00
ID: 9441078
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

 -->Accept mlmcc's comment as Answer

Please leave any comments here within the next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER

GPrentice00
Cleanup Volunteer
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

801 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