I have multiple reports in a web application. I can view them all and print them, no problem. There's on report that I don't want to view, I just want it to print. But it just hangs there.
This is the code:
This is the code:
Code:
dim reportname, Path, iLen
reportname = "report.rpt"
If Not IsObject (session("oApp")) Then
Set session("oApp") = Server.CreateObject("CrystalRuntime.Application")
End If
Path = Request.ServerVariables("PATH_TRANSLATED")
While (Right(Path, 1) <> "\" And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend 'OPEN THE REPORT (but destroy any previous one first)
If IsObject(session("oRpt")) then
Set session("oRpt") = nothing
End if
On error resume next
Set session("oRpt") = session("oApp").OpenReport(path & reportname, 1)
'This line uses the "PATH" and "reportname" variables to reference the Crystal
'Report file, and open it up for processing.
If Err.Number <> 0 Then
Response.write "Error Occurred creating Report Object: " & Err.Description
Set Session("oRpt") = nothing
Set Session("oApp") = nothing
Session.Abandon
Response.End
End If
session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False
session("oRpt").DiscardSavedData
session("oRpt").RecordSelectionFormula = "{MASTER.OrderNo} = " & intOrderNum
On Error Resume Next
session("oRpt").ReadRecords
If Err.Number <> 0 Then
Response.write "Error Occurred Reading Records: " & Err.Description & vbcrlf
Set Session("oRpt") = nothing
Set Session("oApp") = nothing
Session.Abandon
Response.End
Else
If IsObject(session("oPageEngine"))Then
set session("oPageEngine") = nothing
End If
set session("oPageEngine") = session("oRpt").PageEngine
End If
session("oRpt").PrintOut true,1
If Err.Number <> 0 Then
Response.Write "Error Occurred Printing: " & Err.Description & vbcrlf
Set Session("oRpt") = nothing
Set Session("oApp") = nothing
Session.Abandon
Response.End
End If