Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select only one
Message
General information
Forum:
ASP.NET
Category:
Reporting
Title:
Miscellaneous
Thread ID:
00748736
Message ID:
00749003
Views:
23
Hi Raymond,

If you are trying to use variables from your VB .NET code then you need to use the ParameterValues array and the ParameterDiscreteValue class. You create a Paramater Field in Crystal Reports and then in the Record Selection you use the Parameter Field. Here is the VB .NET code to populate the parameter value and then call the report. This sample is using the Northwind Customer table and passing in the CustomerID I want to display. I created a Paramter Field called "MyParam":
Dim oReport As New CrystalReport1()

Dim paramValues As New ParameterValues()
Dim discreteValue As New ParameterDiscreteValue()

' Set your parameter variable here
discreteValue.Value = "ANTON"
paramValues.Add(discreteValue)

oReport.DataDefinition.ParameterFields("MyParam").ApplyCurrentValues.(paramValues)
crystalReportViewer1.ReportSource = oReport
For the Crystal Reports Record Selection, here is what I am using for syntax:
{Customers.CustomerID} = {?MyParam}
>I am new to .NET, new to VB.NET and new to Crystal Reports.
>
>I have a form with the Crystal control and the report works well for all the data in the table.
>However in my program, I want to print the report for only one criteria: TRAINEE.ID (which is my VB variable)
>
>I went in the Record selection formula editor and enter a Trainee.ID which is 355659 and it works.
>When I enter the following formula {Reports.RepTrID} = {Trainee.ID} I get an error in formula:
>
>'Reports.RepTrID=Trainee.ID'
>The remaining text does not appear to be part of the formula.
>
>What am I doing wrong?
>
>Thanks in advance.
>
>Raymond
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform