Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select only one
Message
Information générale
Forum:
ASP.NET
Catégorie:
Rapports
Titre:
Divers
Thread ID:
00748736
Message ID:
00750904
Vues:
14
Hi Cathi,

Thank you for the reply.
Being so new to all this, I do not know where to place the code you sent me.

Let me go into more detail.
I have a form called frmFOT102F that has the Crystal Report Viewer control on it (nothing else) and has generated the following code:

Private Sub CrystalReportViewer1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Load
End Sub

Private Sub frmFOT102F_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub


This form is called from another form which has a command button with the following code:

Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click
Dim PrintDetail As New frmFOT102F()
PrintDetail.Show()
End Sub

So when I press the button on this last form the report is generated for all the data.

So now, where do I place your code to get only the current trainee?

Thank you for your patience.

Raymond

>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform