' CREATE THE APPLICATION OBJECT
If Not IsObject (session("oApp") Then
Set session("oApp" = Server.CreateObject("Crystal.CRPE.Application"
End If
' CREATE THE REPORT OBJECT
'
'The Report object is created by calling the Application object's OpenReport method.
'OPEN THE REPORT (but destroy any previous one first)
If IsObject(session("oRpt") then
Set session("oRpt" = nothing
End if
Set session("oRpt" = session("oApp".OpenReport(path & reportname, 1)
'you must open that report by creating a new session("oRpt" object.
set session("oRptOptions" = Session("oRpt".Options
session("oRptOptions".MorePrintEngineErrorMessages = 0
session("oRpt".DiscardSavedData
' Insert a value for the Crystal Report Parameter Field
'The first parameter passed to the SetCurrentValue method is the value
'that you want to pass to the Crystal Reports parameter field. The
'second parameter is the datatype of the value you are passing to the
'Crystal Parameter field.
'Since we are passing a VBScript variable as the value for the parameter
'we must cast the variable as the proper datatype before passing it to
'the report. This is because VBScript variables are not datatyped unless
'cast.
'Below is a list of Crystal Data types, the VBScript cast functions and
'data type qualifier parameter to pass to the SetCurrentValue method:
' Param Field Type VBScript Call Type Number
'
' NumberField CDbl 7
' CurrencyField CDbl 8
' Boolean CBool 9
' StringField CStr 12
' Retrieve the Records and Create the "Page on Demand" Engine Object
'====================================================================================
On Error Resume Next
session("oRpt".ReadRecords
If Err.Number <> 0 Then
Response.Write "An Error has occured on the server in attempting to access the data source"
Else
If IsObject(session("oPageEngine") Then
set session("oPageEngine" = nothing
End If
set session("oPageEngine" = session("oRpt".PageEngine
End If
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.