Change Printer at run time for crystal rpt, VB6.0
hello every one, i wish to be able to change the printer which prints my voucher/reports designed in a Seagate crystal report after issueing a number of copies to an initial printer after the printer setup dialog box has been displayed.
i tryied using the PrinterName property which comes with the "Crystal Report Control" but it is not working. like this;
Private Sub cmdPrint_Click()
Dim vPrinter As Printer
cdlDialog.Flags = cdlPDReturnDefault
cdlDialog.Flags = cdlPDPrintSetup
cdlDialog.ShowPrinter
rptMulty.PrinterName = vPrinter.DeviceName
If vDataType = False Then
rptMulty.DataFiles(0) = vDataFile
rptMulty.ReportFileName = vReportPath & "Voucher.rpt"
Else
rptMulty.Connect = strConn
rptMulty.DiscardSavedData = True
rptMulty.ReportFileName = vReportPath & "Voucher3.rpt"
End If
'Do Until vCount = vPrintQty
a$ = rstNewMaster("Serial")
'If vDataType = False Then
'rptMulty.SelectionFormula = "{MasterTable.Serial}= " & rstNewMaster("Serial")
'Else
'rptMulty.SelectionFormula = "{MasterTable.Serial}= '" & rstNewMaster("Serial") & "'"
'End If
rptMulty.Destination = crptToPrinter
rptMulty.Action = 1
vCount = vCount + 1
rstNewMaster("Status") = "-1"
rstNewMaster.Update
rstNewMaster.MoveNext
loop
sampong
|