Parameters and CrystalReports.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to CrystalReports and I just want to use the print functionality. I
am currently passing a data set and that works just fine:

Dim rpt As New QuoteDetail
rpt.SetDataSource(ds)
rpt.PrintToPrinter(1, False, 0, 0)
rpt.Dispose()


I have added some parameter fields because the existing printout needs to be
modified. How do I add a parameter to Crystal Reports? I have already added
the parameters to the report and now when I execute the above lines I get an
exception indicating that there are no parameters. I have parameters such as

Terms
QuoteFile
PreparerName

Which are all strings. If I just want to set the parameter 'Terms' to
something like "NET 30" how do I do that? I have tried

rpt.Parameter_Terms.CurrentValues.AddValue("Net 30")

But that does not seem to add the parameter.

Any suggestions?

Kevin
 
I noticed that in the following:

Dim rpt As New QuoteDetail
Dim disVal As New CrystalDecisions.Shared.ParameterDiscreteValue()

disVal.Value = "Net 30"
rpt.Parameter_Terms.CurrentValues.Add(disVal)

disVal = New CrystalDecisions.Shared.ParameterDiscreteValue()
disVal.Value = q.FileName
rpt.Parameter_QuoteFile.CurrentValues.Add(disVal)

disVal = New CrystalDecisions.Shared.ParameterDiscreteValue()
disVal.Value = "Me"
rpt.Parameter_PreparerName.CurrentValues.Add(disVal)

rpt.SetDataSource(ds)

rpt.PrintToPrinter(1, False, 0, 0)
rpt.Dispose()

Just before the SetDataSource() there are current values but the call to
SetDataSource seems to clear these values out. How do I make them "permanent"?

Thank you.

Kevin
 
Back
Top