vb6打印没有预览的Crystal报表,然后单击打印按钮

时间:2015-10-14 14:21:01

标签: printing crystal-reports vb6

我正在使用VB6和Crystal Report 8.5,我想直接使用默认打印机打印我的报告而不预览并单击打印按钮。我有这个代码,但是当我尝试打印它时会向我显示预览,我必须单击打印按钮进行打印 这是我的代码

With MAIN.CR
    .Reset: MAIN.InitCrys
    .ReportFileName = App.Path & "\Reports\rptCashInvoice.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

1 个答案:

答案 0 :(得分:1)

尝试类似:

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。

Look at this page