locked
Crystal Report Date Range in vb.net RRS feed

  • Question

  • Hi All,

    As far as I have learned, I created a report based on single date search

    and it works fine. Now I want to create a period selection using 2 date

    parameteres. I have tried a lot and googled on many pages and I am

    not able to cleary understand where I made a mistake. Apart from the

    code point, the crystal report standalone works well for the date range.

    Could you please anyone make me workout this report.  The following is

    my code it works for a startdate only. Thanks in advance.....

            Dim cryRpt As New ReportDocument
            cryRpt.Load("\\Admin\data\CLDetails.rpt")
            'cryRpt.Load(Application.StartupPath + "CLdetails.rpt")

            Dim cpfDefs As ParameterFieldDefinitions
            Dim cpfDef As ParameterFieldDefinition
            Dim cpValues As New ParameterValues
            Dim cpdValue As New ParameterDiscreteValue
            Dim cpdValue1 As New ParameterDiscreteValue

            cpdValue.Value = frmReports.dtpStart.Value.ToString
            cpdValue1.Value = frmReports.dtpEnd.Value.ToString
            cpfDefs = cryRpt.DataDefinition.ParameterFields
            cpfDef = cpfDefs.Item("BillDate")
            cpValues = cpfDef.CurrentValues

            cpValues.Clear()
            cpValues.Add(cpdValue)
            cpfDef.ApplyCurrentValues(cpValues)

            crall.ReportSource = cryRpt
            crall.Refresh()


    • Edited by Little Jones Friday, July 20, 2012 10:31 AM
    • Moved by Jie Bao Tuesday, July 24, 2012 8:56 AM (From:Visual Basic General)
    Friday, July 20, 2012 10:30 AM

Answers