I have a continuous form with multiple columns and unbound text fields in the header for each field for search boxes and they all work fine with the code below in the on change event. What I would really like is to have the form filter the records based on the text in all of the unbound text boxes.
So when I type in a number in the text box for the quote number field AND type in, let's say, apartial description in another of the search boxes the form gets filtered based on both (or all) of my search boxes.
Any help would be appreciated.
Thanks
EDITED BY THE_DOC_MAN TO INSERT CODE TAGS. NO OTHER CHANGES TO TEXT OR CODE.
So when I type in a number in the text box for the quote number field AND type in, let's say, apartial description in another of the search boxes the form gets filtered based on both (or all) of my search boxes.
Any help would be appreciated.
Thanks
Code:
Private Sub txtNumberFilter_Change()
Dim strFilter As String
On Error GoTo ErrHandler
If Me.txtNumberFilter.Text <> "" Then
strFilter = "[QuoteNumber] Like '*" & Me.txtNumberFilter.Text & "*'"
Me.Filter = strFilter
Me.FilterOn = True
Else
Me.Filter = ""
Me.FilterOn = False
End If
With Me.txtNumberFilter
.SetFocus
.SelStart = Len(Me.txtNumberFilter.Text)
End With
Exit Sub
ErrHandler:
MsgBox Err.Description, vbExclamation
End Sub
EDITED BY THE_DOC_MAN TO INSERT CODE TAGS. NO OTHER CHANGES TO TEXT OR CODE.
Last edited by a moderator: