views:

890

answers:

1

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
A: 

Have a look at this link

How to Load and Display Crystal Reports in VB.NET

The following code shows how to load Crystal Reports in VB.NET, solving all the issues of logon, including sub reports and parameter passing. You can view your reports by simply calling the required functions with its parameters.

astander