Guest_imported
New member
- Jan 1, 1970
- 0
I use this code an always get error 424 object required
<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<sCRIPT LANGUAGE="VBScript" RUNAT="Server">
ReportName = MID(request.ServerVariables("PATH_TRANSLATED", 1, (LEN(request.ServerVariables("PATH_TRANSLATED")-18)) & "moe_gradsurvey_04_deg_poly_test.rpt"
On Error Resume Next
If Not IsObject ( session("oApp" ) Then
Set session ("oApp" = Server.CreateObject("CrystalRuntime.Application"
End If
Call session("oApp".SetMorePrintEngineErrorMessages(0)
Call session("oApp".SetMatchLogonInfo(1)
If IsObject(session("oRpt") then
Set session("oRpt" = nothing
End if
Set session("oRpt" = session("oApp".openReport(Reportname,1)
Session("oRpt".MorePrintEngineErrorMessages = 0
session("oRpt".DiscardSavedData
'for testing only
set session("unitcode"="Pohjois-Karjalan ammattikorkeakoulu"
'Select Unit Code
session("oRpt".ParameterFields(1).AddCurrentValue(session("unitcode")
'select Degree
session("oRpt".ParameterFields(2).AddCurrentValue(Request.Form("degreelist")
'select startdate
'session("oRpt".ParameterFields(3).AddCurrentValue(date(Request.Form("startdate"))
'select enddate
'session("oRpt".ParameterFields(4).AddCurrentValue(date(Request.Form("enddate"))
If Err.Number <> 0 Then
Response.Write "An Error has occured. Please check the ASP page.<BR>"
Response.Write "Error " & Err.number & " " & Err.description
Else
If IsObject(session("oPageEngine") Then
set session("oPageEngine" = nothing
End If
set session("oPageEngine" = session("oRpt".PageEngine
End If
</SCRIPT>
<OBJECT ID="CRViewer1"
CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
WIDTH=100%
HEIGHT=100%
CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,0,0,371">
' Customize the Report Viewer to turn on/off the group tree
If Request.Form("chkGroupTree" = "ON" Then<param name="DisplayGroupTree" value=1>Else<param name="DisplayGroupTree" value=0>End If<param name="EnableRefreshButton" value=1><param name="EnablePrintButton" value=1><param name="EnableExportButton" value=1><param name="EnableSearchControl" value=1><param name="EnableDrillDown" value=1><param name="EnableAnimationControl" value=1><param name="EnableZoomControl" value=1></OBJECT>
<SCRIPT LANGUAGE="VBScript">
Call Page_Initialize
Sub Page_Initialize
On Error Resume Next
Dim WebBroker1
Set WebBroker1 = CreateObject("WebReportBroker.WebReportBroker"
Call GetURL(URL)
if ScriptEngineMajorVersion < 2 then
window.alert "IE 3.02 users on NT4 need to get the latest version of VBScript or install IE 4.01 SP1. IE 3.02 users on Win95 need DCOM95 and latest version of VBScript, or install IE 4.01 SP1. These files are available at Microsoft's web site."
CRViewer1.ReportName = URL + "rptserver.asp"
else
Dim WebSource1
Set WebSource1 = CreateObject("WebReportSource.WebReportSource"
WebSource1.ReportSource = WebBroker1
WebSource1.URL = URL + "rptserver.asp"
WebSource1.PromptOnRefresh = true
CRViewer1.ReportSource = WebSource1
end if
CRViewer1.ViewReport
End Sub
Sub GetURL(ByRef URL)
HREF = Location.Href
URL= ""
nPos = InStr(HREF, "/"
While (nPos > 0)
URL = URL & Left( HREF, nPos )
HREF = Mid(HREF, nPos + 1)
nPos = InStr(HREF, "/"
Wend
End Sub
</SCRIPT>
</BODY>
</HTML>
<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<sCRIPT LANGUAGE="VBScript" RUNAT="Server">
ReportName = MID(request.ServerVariables("PATH_TRANSLATED", 1, (LEN(request.ServerVariables("PATH_TRANSLATED")-18)) & "moe_gradsurvey_04_deg_poly_test.rpt"
On Error Resume Next
If Not IsObject ( session("oApp" ) Then
Set session ("oApp" = Server.CreateObject("CrystalRuntime.Application"
End If
Call session("oApp".SetMorePrintEngineErrorMessages(0)
Call session("oApp".SetMatchLogonInfo(1)
If IsObject(session("oRpt") then
Set session("oRpt" = nothing
End if
Set session("oRpt" = session("oApp".openReport(Reportname,1)
Session("oRpt".MorePrintEngineErrorMessages = 0
session("oRpt".DiscardSavedData
'for testing only
set session("unitcode"="Pohjois-Karjalan ammattikorkeakoulu"
'Select Unit Code
session("oRpt".ParameterFields(1).AddCurrentValue(session("unitcode")
'select Degree
session("oRpt".ParameterFields(2).AddCurrentValue(Request.Form("degreelist")
'select startdate
'session("oRpt".ParameterFields(3).AddCurrentValue(date(Request.Form("startdate"))
'select enddate
'session("oRpt".ParameterFields(4).AddCurrentValue(date(Request.Form("enddate"))
If Err.Number <> 0 Then
Response.Write "An Error has occured. Please check the ASP page.<BR>"
Response.Write "Error " & Err.number & " " & Err.description
Else
If IsObject(session("oPageEngine") Then
set session("oPageEngine" = nothing
End If
set session("oPageEngine" = session("oRpt".PageEngine
End If
</SCRIPT>
<OBJECT ID="CRViewer1"
CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
WIDTH=100%
HEIGHT=100%
CODEBASE="/viewer/activeXViewer/activexviewer.cab#Version=8,0,0,371">
' Customize the Report Viewer to turn on/off the group tree
If Request.Form("chkGroupTree" = "ON" Then<param name="DisplayGroupTree" value=1>Else<param name="DisplayGroupTree" value=0>End If<param name="EnableRefreshButton" value=1><param name="EnablePrintButton" value=1><param name="EnableExportButton" value=1><param name="EnableSearchControl" value=1><param name="EnableDrillDown" value=1><param name="EnableAnimationControl" value=1><param name="EnableZoomControl" value=1></OBJECT>
<SCRIPT LANGUAGE="VBScript">
Call Page_Initialize
Sub Page_Initialize
On Error Resume Next
Dim WebBroker1
Set WebBroker1 = CreateObject("WebReportBroker.WebReportBroker"
Call GetURL(URL)
if ScriptEngineMajorVersion < 2 then
window.alert "IE 3.02 users on NT4 need to get the latest version of VBScript or install IE 4.01 SP1. IE 3.02 users on Win95 need DCOM95 and latest version of VBScript, or install IE 4.01 SP1. These files are available at Microsoft's web site."
CRViewer1.ReportName = URL + "rptserver.asp"
else
Dim WebSource1
Set WebSource1 = CreateObject("WebReportSource.WebReportSource"
WebSource1.ReportSource = WebBroker1
WebSource1.URL = URL + "rptserver.asp"
WebSource1.PromptOnRefresh = true
CRViewer1.ReportSource = WebSource1
end if
CRViewer1.ViewReport
End Sub
Sub GetURL(ByRef URL)
HREF = Location.Href
URL= ""
nPos = InStr(HREF, "/"
While (nPos > 0)
URL = URL & Left( HREF, nPos )
HREF = Mid(HREF, nPos + 1)
nPos = InStr(HREF, "/"
Wend
End Sub
</SCRIPT>
</BODY>
</HTML>