Imports System.Data.OleDb
Public Class ExpireRem

    Private dbc As New OleDbConnection(conStr)
    Private Sub loadex()
        Dim dba As New OleDbDataAdapter("SELECT * FROM tbExpired", dbc)
        Dim dbs As New DataSet
        dba.Fill(dbs)
        Me.DataGridView1.DataSource = dbs.Tables(0).DefaultView
    End Sub
    Private Sub DateTimePicker1_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker1.ValueChanged
        Dim dba As New OleDbDataAdapter("SELECT * FROM tbExpired WHERE DateRemInv BETWEEN #" & Me.DateTimePicker1.Value & "# AND #" & Me.DateTimePicker2.Value & "#;", dbc)
        Dim dbs As New DataSet
        dba.Fill(dbs)
        Me.DataGridView1.DataSource = dbs.Tables(0).DefaultView
        loadex()

    End Sub

    Private Sub DateTimePicker2_ValueChanged(sender As Object, e As EventArgs) Handles DateTimePicker2.ValueChanged
        Dim dba As New OleDbDataAdapter("SELECT * FROM tbExpired WHERE DateRemInv BETWEEN #" & Me.DateTimePicker1.Value & "# AND #" & Me.DateTimePicker2.Value & "#;", dbc)
        Dim dbs As New DataSet
        dba.Fill(dbs)
        Me.DataGridView1.DataSource = dbs.Tables(0).DefaultView
        loadex()
    End Sub

    Private Sub ExpireRem_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        loadex()
    End Sub
End Class