Multi Combo Box Search - Clearing filter to show all results

teachme

Registered User.
Local time
Yesterday, 20:00
Joined
Oct 26, 2015
Messages
84
Hi, I have the code below to filter results based on the combo box values.

When the clear button is clicked, it clears the values in combo boxes but it does not show all results.

I tried the code below for the clear butoon but it didnt work either, any thoughts?
--
Me.Filter = ""
Me.Requery
--


Function SearchCriteria()
Dim ProjectIDSearch, strProjectManagerSearch As String
Dim task, strCriteria As String

If IsNull(Me.cbProjectIDSearch) Then
ProjectIDSearch = "[Project ID] like '*'"
Else
ProjectIDSearch = "[Project ID] = '" & Me.cbProjectIDSearch & "'"
End If

If IsNull(Me.cbProjectManagerSearch) Then
strProjectManagerSearch = "[Project Manager] like '*'"
Else
strProjectManagerSearch = "[Project Manager] = '" & Me.cbProjectManagerSearch & "'"
End If

strCriteria = ProjectIDSearch & "And" & strProjectManagerSearch
task = "Select * from tblProjectInfo where " & strCriteria
Me.sfProjects.Form.RecordSource = task
Me.sfProjects.Form.Requery

End Function"

For Clear button, the code is below

"Private Sub cmdClear_Click()
Me.cbProjectIDSearch = Null
Me.cbProjectManagerSearch = Null
End Sub"
 
I'm not sure but try

Me.Filter = ""
Me.FilterOn = False
 
Thanks - when I delete the values from the combo box and tab away from the combo box, it shows all results (removes the filter) but when I use the command button to clear the values from combo box(es), it does not populate all results (removes filter).
 

Users who are viewing this thread

Back
Top Bottom