I am trying to create button that runs a filter in VBA that search several fields (Combo boxes and memo fields) for a key word. I started off just filtering one combo box with only a single word in it using this code and it works!
I am now attempting to filter a memo field but can’t get the code to work? See Below.
I have tried several different variation of this code with the * in a different spot and I either get errors or no results? Anyone see what I am doing wrong? And how do I add more fields on to the filter? Do I just use "Or" and repeat the code?
Code:
Private Sub Apply_Filter_Click()
Dim MyValue As String
MyValue = InputBox("Enter Keyword")
Me.Filter = "[Field1] = '" & MyValue & "'"
Me.FilterOn = True
End Sub
Code:
Private Sub Apply_Filter_Click()
Dim MyValue As String
MyValue = InputBox("Enter Keyword")
Me.Filter = "[Field1] = '*" & MyValue & "*'"
Me.FilterOn = True
End Sub
Comment