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!

AVOID PARAMETERS PROMPTING...HELP!!!! HEEELP!!!

Status
Not open for further replies.

lechuz

Programmer
Jan 8, 2003
26
0
0
MX
How can I avoid the parameter prompting?

I have a report that uses 2 parameters... I made the following code to pass these parameters trough the URL in the "interactiveviewer.asp" and works fine It sends the parameters to the report, but it still prompting me for the parameters (the fields appear filled with the values sent in the URL) and my user need to press "accept" to get into the report.

How can I avoid this step?

This is the code that I put in the "interactiveviewer.asp":

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

.Item(1).CopyTo NewParam
ValContent = Request.QueryString("Param2")
Set NewVal = ObjectFactory.CreateObject("CrystalReports.ParameterFieldDiscreteValue")
NewVal.Value = CInt(ValContent)
NewParam.DefaultValues.add NewVal
clientDoc.DataDefController.ParameterFieldController.Modify .Item(1), NewParam

End With
 
There is a prompt option in the RDC per parameter - have you tried setting this to false? I don't know vb so I can't give you the code to this.
 
Use '.Export False' in VB. It will supress the prompt while exporting. Here is what I use:

Set CrxReport = crxApplication.OpenReport(App.Path & "\" & iniReportName)
CrxReport.DiscardSavedData
CrxReport.ParameterFields.GetItemByName("FirstDate").AddCurrentValue VBA.DateAdd("d", iniReportInterval, VBA.Date())
CrxReport.ParameterFields.GetItemByName("LastDate").AddCurrentValue VBA.Date
strFileName = "\reports\Dispense_Log_" & Format$(Now, "mmddyyyy") & ".pdf"
With CrxReport
With .ExportOptions
.FormatType = crEFTPortableDocFormat
.DiskFileName = App.Path & strFileName
.DestinationType = crEDTDiskFile
End With
.Export False
End With
 
The solution:

The problema was that I was using:

NewParam.DefaultValues.add NewVal

instead of:

NewParam.CurrentValues.add NewVal


Thanks anyway!!!
 
HI

I m a newby with Crystal Report...:), I'm trying to generate a view and then a PDF file with a RPT + SP + Paramaters + ASP

I use the (lechuz's )examples of this post, and it works...but there is a problem : the view is correctly generated into my browser, but when I export it to a PDF or a excel file, only the last parameter I used seems to be taken... the first ones are considered with a NULL value....(only when I export)

I hope you understand my problem (my english is not very good) Someone can help me please ??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top