Hello, I have the following code to filter a listbox based on a combo box selection. I need a separate button that can clear the filter and display all records. I don't know how to do. Need help from learned members here. Thanks.
This filters the listbox based on the combo box selection .
Option Compare Database
Dim strListSource As String
Private Sub Combo47_AfterUpdate()
If Me.Combo47.ListIndex < 0 Then
Me.List29.RowSource = strListSource & ";"
Else
Me.List29.RowSource = strListSource & " WHERE tbl_Products.PlantID = " & Me.Combo47
End If
Me.List29.Requery
End Sub
Private Sub Form_Load()
strListSource = Replace(Me.List29.RowSource, ";", "")
End Sub
This filters the listbox based on the combo box selection .
Option Compare Database
Dim strListSource As String
Private Sub Combo47_AfterUpdate()
If Me.Combo47.ListIndex < 0 Then
Me.List29.RowSource = strListSource & ";"
Else
Me.List29.RowSource = strListSource & " WHERE tbl_Products.PlantID = " & Me.Combo47
End If
Me.List29.Requery
End Sub
Private Sub Form_Load()
strListSource = Replace(Me.List29.RowSource, ";", "")
End Sub