I have a report which prints within 1-2 seconds when the selection criteria is specified within the report. However, when the selection value is passed from VBA, the run time increases to at least 30 seconds. I know its passing the right value because the 2 reports print identically. Why is there such a discrepancy?
Function PrintCrystalShopOrder()
Dim crpApplication As New CRPEAuto.Application
Dim crpReport As CRPEAuto.Report
Dim crpFFDs As FormulaFieldDefinitions
Dim crpFFD As FormulaFieldDefinition
Dim crporder As String
Dim loopCnt As Integer
crporder = Format(SaveShopOrd, "00000000")
Set crpReport = crpApplication.OpenReport("M:\crystal\meritec rpts\SFRLPPRTSQLrev4test.rpt")
Set crpFFDs = crpReport.FormulaFields
Set crpFFD = crpFFDs.item(14) 'order number
crpFFD.Text = Chr(34) & crporder & Chr(34)
crpReport.PrintOut
Set crpReport = Nothing
Function PrintCrystalShopOrder()
Dim crpApplication As New CRPEAuto.Application
Dim crpReport As CRPEAuto.Report
Dim crpFFDs As FormulaFieldDefinitions
Dim crpFFD As FormulaFieldDefinition
Dim crporder As String
Dim loopCnt As Integer
crporder = Format(SaveShopOrd, "00000000")
Set crpReport = crpApplication.OpenReport("M:\crystal\meritec rpts\SFRLPPRTSQLrev4test.rpt")
Set crpFFDs = crpReport.FormulaFields
Set crpFFD = crpFFDs.item(14) 'order number
crpFFD.Text = Chr(34) & crporder & Chr(34)
crpReport.PrintOut
Set crpReport = Nothing