How to include parameter value in report header using crystal report?

dee_yu12

New member
Joined
Dec 22, 2009
Messages
1
Programming Experience
Beginner
Gud day! I'm creating a report using cystal report and vb 2008. The report goes like this:
Printing all records from database within a period of time. Now my problem is I want in my
report header a text, which will be the title of my report, saying like this "All Patient
Diagnosed from 10/15/2009 to 12/19/2009". I don't know how to include those dates in my report
which come from the user I really need help plese! :(

I created two discrete parameters in crystal report that will hold for the dates the user
inputted and the selection formula is:
{tblDiagnosis.d_date} = {?rpt_date_from} to {?rpt_date_to}

and my code in command button is :

Private Sub ToolStripButton4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton4.Click


Dim date_from As String
Dim date_to As String


date_from = cmbDateFrom.Text
date_to = cmbDateTo.Text

Dim cryRpt As New report_printWdate
cryRpt.SetDatabaseLogon("sa", "sa", "localhost", "CHD")


Dim crParameterFieldDefinitions As ParameterFieldDefinitions
Dim crParameterFieldDefinition As ParameterFieldDefinition
Dim crParameterValues As New ParameterValues
Dim crParameterDiscreteValue As New ParameterDiscreteValue


crParameterDiscreteValue.Value = date_from
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("rpt_date_from")
crParameterValues = crParameterFieldDefinition.CurrentValues

crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)

crParameterDiscreteValue.Value = date_to
crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
crParameterFieldDefinition = crParameterFieldDefinitions.Item("rpt_date_to")
crParameterValues = crParameterFieldDefinition.CurrentValues

crParameterValues.Clear()
crParameterValues.Add(crParameterDiscreteValue)
crParameterFieldDefinition.ApplyCurrentValues(crParameterValues)
 

Latest posts

Back
Top