Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have multiple reports in a web ap

Status
Not open for further replies.

earme

Programmer
Jul 27, 2000
155
US
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:
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) <> &quot;\&quot; 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(&quot;oRpt&quot;)) then
  Set session(&quot;oRpt&quot;) = nothing
End if
On error resume next
Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(path & reportname, 1)
'This line uses the &quot;PATH&quot; and &quot;reportname&quot; variables to reference the Crystal
'Report file, and open it up for processing.
If Err.Number <> 0 Then
  Response.write &quot;Error Occurred creating Report Object: &quot; & Err.Description 
  Set Session(&quot;oRpt&quot;) = nothing
  Set Session(&quot;oApp&quot;) = nothing
  Session.Abandon
  Response.End
End If
session(&quot;oRpt&quot;).MorePrintEngineErrorMessages = False
session(&quot;oRpt&quot;).EnableParameterPrompting = False
session(&quot;oRpt&quot;).DiscardSavedData
session(&quot;oRpt&quot;).RecordSelectionFormula = &quot;{MASTER.OrderNo} = &quot; & intOrderNum
On Error Resume Next
session(&quot;oRpt&quot;).ReadRecords
If Err.Number <> 0 Then   
  Response.write &quot;Error Occurred Reading Records: &quot; & Err.Description & vbcrlf
  Set Session(&quot;oRpt&quot;) = nothing
  Set Session(&quot;oApp&quot;) = nothing
  Session.Abandon
  Response.End

Else
  If IsObject(session(&quot;oPageEngine&quot;))Then
    set session(&quot;oPageEngine&quot;) = nothing
  End If
  set session(&quot;oPageEngine&quot;) = session(&quot;oRpt&quot;).PageEngine
End If
session(&quot;oRpt&quot;).PrintOut true,1
If Err.Number <> 0 Then
 Response.Write &quot;Error Occurred Printing: &quot; & Err.Description & vbcrlf
  Set Session(&quot;oRpt&quot;) = nothing
  Set Session(&quot;oApp&quot;) = nothing
  Session.Abandon
  Response.End

End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top