Link to home
Start Free TrialLog in
Avatar of VijayK
VijayK

asked on

Passing Parameter value to ActiveXViewer

I am Using ActiveXViwer to display Crystal Reports in ASP Page.
I have one Parameter field in my Report called "ID".
How i will pass value for that parameter? Please help me.

I have to export and Print the report once it displayed. So i am using ActiveXViewer. Am i right?

ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of VijayK
VijayK

ASKER

Here is the code which i am using...

<OBJECT ID="CRViewer" CLASSID="CLSID:2DEF4530-8CE6-41C9-84B6-A54536C90213"
    WIDTH=80% HEIGHT=100%   codebase="/viewer9/activeXViewer/activexviewer.cab#Version=9,2,0,442">
<PARAM NAME="EnableDrillDown" VALUE=0>
<PARAM NAME="EnableExportButton" VALUE=1>
<PARAM NAME="DisplayGroupTree" VALUE=0>
<PARAM NAME="EnableGroupTree" VALUE=0>
<PARAM NAME="EnableAnimationControl" VALUE=1>
<PARAM NAME="EnablePrintButton" VALUE=1>
<PARAM NAME="EnableRefreshButton" VALUE=1>
<PARAM NAME="EnableSearchControl" VALUE=1>
<PARAM NAME="EnableZoomControl" VALUE=1>
<PARAM NAME="EnableSelectExpertButton" VALUE=1>
</OBJECT>

<SCRIPT LANGUAGE="VBScript">
<!--
Sub window_onLoad()

   Page_Initialize()

End Sub


Sub Page_Initialize
   On Error Resume Next

    Dim webBroker
    Set webBroker = CreateObject("WebReportBroker9.WebReportBroker")
    if err.number <> 0 then
        window.alert "_LOC_The Crystal ActiveX Viewer is unable to create its resource objects_ENDLOC_."
    else
        Dim webSource
        Set webSource = CreateObject("WebReportSource9.WebReportSource")
        webSource.ReportSource = webBroker
        webSource.URL = "rptserver.asp?ApplicationId=1222"
        webSource.PromptOnRefresh = True
        webSource.AddParameterEx "AppId","1222",crPrompt  
        CRViewer.ReportSource = webSource
    end if
    CRViewer.ViewReport

End Sub
-->
</SCRIPT>


--------------------------
Opening the report takes place in "rptserver.asp" page using "ReportClientDocument" object.

Can you please help me...

Is AppId a string or numeric field?

If it is numeric try

 webSource.AddParameterEx "AppId",1222,crPrompt  

mlmcc
Glad I could help

mlmcc