vb6打印水晶报告没有预览和点击打印按钮



我使用VB6和Crystal Report 8.5,我想直接用默认打印机打印我的报告,而不需要预览并单击打印按钮。我有这个代码,但每当我尝试打印它显示我预览,我必须点击打印按钮打印过程这是我的代码

With MAIN.CR
    .Reset: MAIN.InitCrys
    .ReportFileName = App.Path & "ReportsrptCashInvoice.rpt"
    .Connect = "POS"
    strTitle = "Cash Invoice"
    strSelFormula = "{Cash_Sales.InvoiceNo} ='" & InvoiceNo & "'"
    .SelectionFormula = strSelFormula
            .WindowTitle = strTitle
            .ParameterFields(0) = "prmCompany;" & CurrBiz.BUSINESS_NAME & ";True"
            .ParameterFields(1) = "prmAddress;" & CurrBiz.BUSINESS_ADDRESS & ";True"
            .ParameterFields(2) = "prmContactInfo;" & CurrBiz.BUSINESS_CONTACT_INFO & ";True"
            .PrintReport
            .DiscardSavedData = True
End With

试试这样写:

Dim crxApp As CRAXDRT.Application
Dim crxRpt As CRAXDRT.Report
Set crxApp = New CRAXDRT.Application
Set crxRpt = crxApp.OpenReport("C:MyReport.rpt")
crxRpt.PrintOut False, NoCopies 

如果需要在默认打印机以外的其他打印机上打印报告,请尝试使用SelectPrinter。

看这一页

最新更新