Kingcoder210 0 Light Poster

How can I show report between two dates? I have shown report by ID number through parameter. To do it I had one text box & one report viewer & button. But now I have two text boxes to write two different date one button & one report viewer. What should I do to show report between two dates?

My code :

Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class Form6
    Inherits System.Windows.Forms.Form
    

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        'Dim cryRpt As New ReportDocument
        'cryRpt.Load(Application.StartupPath & "\CrystalReport5.rpt")
        'CrystalReportViewer1.ReportSource = cryRpt
        'CrystalReportViewer1.Refresh()

        Dim cryRpt As New ReportDocument
        cryRpt.Load(Application.StartupPath & "\CrystalReport5.rpt")

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

        crParameterDiscreteValue.Value = TextBox1.Text
        crParameterFieldDefinitions = cryRpt.DataDefinition.ParameterFields
        crParameterFieldDefinition = crParameterFieldDefinitions.Item("id")
        crParameterValues = crParameterFieldDefinition.CurrentValues

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

        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()
        cryRpt.RecordSelectionFormula = "{Button1}= " & TextBox1.Text & ""
    End Sub

Please tell me what should I write now to show record between two dates?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.