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!

Crystal Parameters at runtime

Status
Not open for further replies.

DTJeff

Programmer
Dec 9, 2003
37
0
0
GB
Hi all.

I'm having a problem with passing some parameters to a crystal report at runtime.

Heres the code I'm trying to use (found it in msdn).

Code:
Dim paramFields As New CrystalDecisions.Shared.ParameterFields
Dim paramField As New CrystalDecisions.Shared.ParameterField
Dim discreteVal As New CrystalDecisions.Shared.ParameterDiscreteValue

        paramField.ParameterFieldName = "Site"
        discreteVal.Value = TextBox1.Text
        paramField.CurrentValues.Add(discreteVal)
        paramFields.Add(paramField)

        paramField = New CrystalDecisions.Shared.ParameterField
        paramField.ParameterFieldName = "Building"
        discreteVal.Value = TextBox2.Text
        paramField.CurrentValues.Add(discreteVal)
        paramFields.Add(paramField)

CrystalReportViewer1.ParameterFieldInfo = paramFields

The problem that occurs, is that both the parameters are set to whatever the last parameter was set to.

Any ideas?

 
I have just found the answer to my own question after playing around abit.

I needed to add:
Code:
discreteVal = New CrystalDecisions.Shared.ParameterDiscreteValue

and all works fine now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top