This is my filter code
I have managed to sort out the ' problem (as in searching for O'Neil etc) however:
EG
When I search "Smith" in surcomp (from textBox1) my filter (results) gives me all of the "Smiths" but only the ones where ALL of my other filter fields are populated.
If I filter on just one textBox then only THAT textBox should apply.
Hope you understand, Hope you can help?
Code:
Private Sub subChangeFilter()
If Trim(Me.textBox1 & Me.textBox2 & Me.textBox3 & Me.textBox4 & Me.textBox5 & "") = "" Then
Me.Filter = False
Else
Me.Filter = "surcomp LIKE '*" & Replace(Me.textBox1, "'", "''") & "*' _
AND First_Name LIKE '" & Me.textBox2 & "*' _
AND Address_Line_1 LIKE '*" & Me.textBox3 & "*' _
AND PostCode LIKE '*" & Me.textBox4 & "*' _
AND Home_Telephone_Number LIKE '*" & Me.textBox5 & "*'"
Me.FilterOn = True
End If
End Sub
I have managed to sort out the ' problem (as in searching for O'Neil etc) however:
EG
When I search "Smith" in surcomp (from textBox1) my filter (results) gives me all of the "Smiths" but only the ones where ALL of my other filter fields are populated.
If I filter on just one textBox then only THAT textBox should apply.
Hope you understand, Hope you can help?