Avatar of JAM1011
JAM1011
 asked on

VB.NET crystal reports passing parameters . Report Load failed error

Hey all,
I am having trouble getting my report to run when I try and pass the parameters values via code. The report runs fine when I type the values in manually.
a message box with "Load Report Failed" come up three times. and the report doesn't load,
I am using VS 2009 PRO
Any Ideas What is wrong with the code


Thanks
James
Dim cryRpt As New ReportDocument



        Dim p1 As New ParameterFields 
        Dim p2 As New ParameterField 
        Dim p22 As New ParameterField 
        Dim p3 As New ParameterDiscreteValue         
Dim p4 As New ParameterDiscreteValue 

        p2.ParameterFieldName = "Name"
        p3.Value = "23"
        p2.CurrentValues.Add(p3)
        p1.Add(p2)
        Form1.CrystalReportViewer1.ParameterFieldInfo = p1 
      

        p22.ParameterFieldName = "Payment_ID"
        p4.Value = "55"
        p22.CurrentValues.Add(p4)
        p1.Add(p22)
        Form1.CrystalReportViewer1.ParameterFieldInfo = p1

        Form1.CrystalReportViewer1.ReportSource = "Kellihers_Lawnmowers.CrystalReport3.rpt"
        Form1.Show()

Open in new window

Visual Basic ClassicDB Reporting ToolsCrystal Reports

Avatar of undefined
Last Comment
JAM1011

8/22/2022 - Mon
Mike McCracken

Are these Crystal parameters?

mlmcc
Mike McCracken

The parameters belong to the report.  You need to assign the report source before assigning the parameters.

They need to be assigned to the report object.

mlmcc
JAM1011

ASKER
I have placed the report source at the top of the code but is still doesn't seem to working I still get the same error . Any ideas ??


Thanks
James
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
ASKER CERTIFIED SOLUTION
Mike McCracken

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
JAM1011

ASKER
Thanks for the help..

Change the line below to the following
Dim CRYRpt1 As New CrystalReport3()

 Form1.CrystalReportViewer1.ReportSource = CRYRpt1

Open in new window