Update a field in a crystal report at run time

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

Guest

Hi,

I made a crystal report which contains a text field of empty value. I want
to know how to fill this field at the run time by a variable. Andbody give a
hand?

Thank in advance
 
Instead of using a blank text field, use a parameter field. Create a
parameter in your report, and then place it on your report. To pass a value
into the parameter, see if this helps:
 
Create a parameter, then create a formula that passes the value from that
parameter into the text field.
Or
Drag the parameter onto the CR and when the report runs have a formula that
controls when the parameter supressed.
Or
If you are getting you data from a dataset just drag that field onto the
report.

http://www.wizkil-webs.net/NET/DotNet_CrystalRpt_Samples.htm

Hope one of those helped.
BrianDH
 
Code example using a parameter thats been placed on the report.
///
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared

Dim crReportDocument As New ReportName
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue

crParameterFieldDefinitions =
crReportDocument.DataDefinition.ParameterFields()
crParameterDiscreteValue = New ParameterDiscreteValue
crParameterFieldDefinition = crParameterFieldDefinitions.Item(0)
crParameterValues = crParameterFieldDefinition.CurrentValues
crParameterDiscreteValue.Value = "Pass Value Here"
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

CrystalReportViewer1.ReportSource = crReportDocument
CrystalReportViewer1.Visible = True
\\\
 
BrianDH & Richard Dudley,

Thanks for your helps. It works fine by using parameters in CR.

Li
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top