SAP Knowledge Base Article - Public

1215426 - Err Msg: "Missing parameter value" when printing or exporting in VS .NET

Symptom

A .NET application uses Crystal Reports for Visual Studio .NET as the reporting development tool.

After the application passes parameters to the report, the report previews successfully. However, if you click the print or export toolbar button from the viewer, the following error message appears:

"Missing parameter value"

Why does this error message appear and how do you resolve it?

 

Resolution

This error message appears because the parameter values are only being passed to the CrystalReportViewer control, and not to the ReportDocument object (engine).

The ReportDocument object (engine) is responsible for passing parameter values when printing and exporting.

To successfully set the parameter values when you preview, print and export the report, you must pass the parameter values to the ReportDocument object (engine).

For example, the following code passes parameters to the ReportDocument object (engine):

Dim crReportDocument As CRParams

Dim crParameterFieldDefinitions As ParameterFieldDefinitions

Dim crParameterFieldDefinition As ParameterFieldDefinition

Dim crParameterValues As ParameterValues

Dim crParameterDiscreteValue As ParameterDiscreteValue

crReportDocument = New CRParams()

crParameterFieldDefinitions = crReportDocument.DataDefinition.ParameterFields

crParameterFieldDefinition = crParameterFieldDefinitions.Item("Country")

crParameterValues = crParameterFieldDefinition.CurrentValues

crParameterValues.Clear()

crParameterDiscreteValue = New ParameterDiscreteValue()

crParameterDiscreteValue.Value = "Canada" '1st current value

crParameterValues.Add(crParameterDiscreteValue)

crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

CrystalReportViewer1.ReportSource = crReportDocument

 

See Also

2281780 - How To: Parameters in Crystal Reports for Visual Studio .NET

Keywords

PARAM MISSING PARAMETER VIEWER DOTNET .NET EXPORT VS VB.NET Crystal Reports for Visual Studio Parameters Exporting and Printing , c2012633 , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , Problem

Product

SAP Crystal Reports, version for Visual Studio .NET 2008