-
April 4th, 2011, 03:21 AM
#1
Passing Paramaters with VB to Crystal Reports
Hi Guys,
Im new to this forum, and I hope some one can help me.
I have a situation where I need to programatically pass paramaters using VB through to my crystal report. I am using Visual Studio 2008 for my development.
Everything is working fine, but when I run the report I get a "Value cannot be Null" error. this is in the Crystal Reports Rorm Viewer.
My complete code is below.
=========================
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Imports System.Data.OleDb
Public Class Form1
Private Sub CrystalReport11_InitReport(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReport11.InitReport
Dim CR As New ReportDocument
CR.Load("C:\VBScript\WindowsApplication1\CrystalReport1.rpt")
Dim crParameterDiscreteValue As ParameterDiscreteValue
Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldLocation As ParameterFieldDefinition
Dim crParameterValues As ParameterValues
crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
crParameterFieldLocation = crParameterFieldDefinitions.Item("@ParameterName1")
crParameterValues = crParameterFieldLocation.CurrentValues
crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
crParameterDiscreteValue.Value = "test"
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
CrystalReportViewer1.ReportSource = CR
End Sub
End Class
=========================
As I said my paramater is passed and displayed on the report, but I keep getting this error...
can anyone help.
-
April 5th, 2011, 11:56 PM
#2
Re: Passing Paramaters with VB to Crystal Reports
Fix your code. Add [] [/] with Code before the ]
-
April 6th, 2011, 06:59 AM
#3
Re: Passing Paramaters with VB to Crystal Reports
I dont understand fix your code?
is it not readable?
-
April 6th, 2011, 09:49 AM
#4
Re: Passing Paramaters with VB to Crystal Reports
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
On-Demand Webinars (sponsored)
|