Thomas Ochieng

Thomas Ochieng

  • NA
  • 5
  • 10.9k

MS Report Viewer 2008

Sep 6 2011 11:27 AM
 

How do I Filter a ReportViewer through a Form?

For example, I would like to choose a Date from a Form and then use this Date to filter the ReportViewer.  Any idea?

E.g

Public Class frmPatientsDetailsMasterReport

Dim sql As String

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub

Private Sub btnViewReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnViewReport.Click

 //sql = "SELECT * FROM tblPatientEntry WHERE RegistrationDate BETWEEN '" & DateTimePicker1.Value & "' AND RegistrationDate '" & DateTimePicker2.value & "'"// not working for me.

'TODO: This line of code loads data into the 'HospitalManagementSystemDataSet.tblPatientEntry' table. You can move, or remove it, as needed.

Me.tblPatientEntryTableAdapter.Fill(Me.HospitalManagementSystemDataSet.tblPatientEntry)

Me.ReportViewer1.RefreshReport()

End Sub

End Class


Answers (2)