filter data between 2 dates in crystal report vb.net

Posted by irienaoki0407 on Stack Overflow See other posts from Stack Overflow or by irienaoki0407
Published on 2009-12-11T13:34:45Z Indexed on 2010/04/07 4:03 UTC
Read the original article Hit count: 1055

Filed under:

I need some help for creating Crystal Reports in VB 2005.

I want to filter data between two dates (like from date and to date) with datetimepicker. I'm using SQL Server 2000 for the connection.

Update:

Thanks for the link, but I'm trying using record selection formula....

Here's my code:

Try
        Dim cryRpt As New ReportDocument
        With cryRpt
            .FileName = ("C:\Documents and Settings\Ratna Ayu\My Documents\Visual Studio 2005\Projects\Denda\Denda\CrystalReport1.rpt")
            .RecordSelectionFormula = "{pinjam.tglkembali}>='" & DateTimePicker1.Value.ToString("dd/MM/yyyy") & "' and {pinjam.tglkembali} =<'" & DateTimePicker2.Value.ToString("dd/MM/yyyy") & "'"

        End With
        CrystalReportViewer1.ReportSource = cryRpt
        CrystalReportViewer1.Refresh()
    Catch ex As Exception
        MsgBox("tdk ada data", , "")
    End Try

© Stack Overflow or respective owner

Related posts about crystal-reports