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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HOW TO PASS A VALUE TO A REPORT WITH ASP, CRYSTAL 9...HELP!!!

Status
Not open for further replies.

lechuz

Programmer
Jan 8, 2003
26
0
0
MX
Some people helped me to edit the "interactiveviewer.asp" to log into the database instead of always prompting for it... now I want to embedd in the code the values for some parameters of my report...

I receive a value from a form and now I want to pass it to the report, I received the following error:

Error Type:
RptControllers.dll (0x80042009)
The types of the parameter field and parameter field current values are not compatible.
/rassamples/en/asp/rPortfolio/HTMLViewers/interactiveViewer.asp, line 48



Here it's the code that I put in the "interactiveviewer.asp":

Set ParamCollection = clientDoc.DataDefinition.ParameterFields
Set ParamToChange = ParamCollection.Item(0)
Set NuevoValor = objectFactory.CreateObject("CrystalReports.ParameterFieldDiscreteValue")
NuevoValor.Value = CStr(Request.Form("Param1"))
Set TempParam = objectFactory.CreateObject("CrystalReports.ParameterField")
ParamToChange.CopyTo TempParam
TempParam.CurrentValues.Add("NuevoValor")

Set ParamController = ClientDoc.DataDefController.ParameterFieldController
ParamController.Modify ParamToChange, TempParam
 
I edited the code to the following:

Set NewParam = ObjectFactory.CreateObject("CrystalReports.ParameterField")
With clientDoc.DataDefinition.ParameterFields
.Item(0).CopyTo NewParam
Dim NewVal
Dim ValContent
ValContent = 1
Set NewVal = ObjectFactory.CreateObject("CrystalReports.ParameterFieldDiscreteValue")
NewVal.Value = ValContent
NewParam.DefaultValues.add NewVal
clientDoc.DataDefController.ParameterFieldController.Modify .Item(0), NewParam

And it's working, now the value it's set to 1 (I used ValContent just to try) but it still prompting me for the parameter, the difference it's that the page displays the current value (1) but my user have to view these values and press "accept"
How can I avoid that?
 
Hi,

thank you for your knowledge sharing...
I start to get some result with your code.

I you don't want the Parameter prompt screen, you have to add this line to your viewer definition:

viewer.EnableParameterPrompt = false

I do it, but get another error:

webReporting.dll (0x8004100E)
Missing parameter values.
/HTMLViewers/interactiveViewer.asp, line 77


If you find something, could you help me also?

Best regards
 
Yes, look at my code there is a line like this:

NewParam.DefaultValues.add NewVal

Change it for:

NewParam.CurrentValues.add NewVal

you don't need to specify the parameter prompt option to false after doing this... hope it helps...

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top