Hi there:
I created a form which I want users to be able to filter using a value entered into an unbound text box (txtSearchP) on the form.
Once the user has entered the search text then the idea is they click on the flitter button (cmdSearchP) on the form I want the results to be filtered based on the Values in two fields [Programme] or [Programme_Desc] so that the filtered results show records where either of these fields contains the search term (txtSearchP).
I can get this to work if I search just one field using the code below:
Private Sub cmdSearchP_Click()
' Filter by Programme Description
Me.Filter = Me.Filter = "[Programme_Desc] Like " & Chr(34) & "*" & Me.txtSearchP & "*" & Chr(34)
Me.FilterOn = True
Me.Requery
End Sub
This works fine but when I try to search for the value in either filed I either end up with error messages or it appears to work but brings back nothing or brings back all records depending on what I put in.
Can anyone help I have been banging my head against the wall for ages with this now I've 'googled' and can't find anything helpful that I could understand. The odd few examples I found and tried didn't work.
I know I could give the users two separate text boxes and Buttons and force then to search either by code of description but I don't want the form to be cluttered and it needs to be idiot proof.
Thanks in advance