Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Vb.NET Crystal Report query

Status
Not open for further replies.

Lxmm

Programmer
May 10, 2005
32
GB
I have a problem using parameters with Crystal reports.

I have a report based on Access query which is similar to something like following

"SELECT * from StudentMain where StudentID=ParaStudentID"

I have a crystal report which is based on the above query so that my users can print details of selected students.
The problem is that every time I run the report Crystal reports prompts to enter a value for ParaStudentID (database query field).
I have passed the value of this field through my program as follows

Dim crReportDocument As New ReportDocument
crReportDocument.Load("C:\StudentDetails.rpt")

Dim RptParameterFields As New ParameterFields
Dim ParaStID As New ParameterField
Dim RptDiscreteValue As New ParameterDiscreteValue
ParaStID.ParameterFieldName = "ParaStudentID"
RptDiscreteValue.Value = Me.txtStudentID.Text
ParaStID.CurrentValues.Add(myDiscreteValue)
RptParameterFields.Add(ParaStID)

Dim fReportViewer As New frmReportViewer
fReportViewer.CRREportViewer1.ReportSource = crReportDocument

I'm bit confused with the parameter field in Crystal report and the paramater of my query. If I want my report to display different student details, which parameter I should use in the report?

Can any one help me to resolve this please?
Thanks in advance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top