MajP, this works perfectly, but it seems if I could understand your comment "Personally I would write one procedure so you do not have to update each and every one" - then I would become a better code writer - I tried your previous code with the "If Not Trim...." but I think it is calling for functions or subs you have written and I am not sure I am skilled enough yet to follow.Personally I would write one procedure so you do not have to update each and every one. But if you want to try one. Try this
Code:Private Sub txtNumberFilter_Change() Dim sText As String Dim strFilter As String ' On Error GoTo ErrHandler sText = Me!txtNumberFilter.Text If sText <> "" Then strFilter = "[OrderNumber] Like '*" & sText & "*'" Me.Filter = strFilter Me.FilterOn = True Else Me.Filter = "" Me.FilterOn = False End If If Me.Recordset.RecordCount = 0 Then MsgBox "No records match " & Me.Filter, vbInformation, "No Match" Me.FilterOn = False DoEvents Me.txtNumberFilter.SetFocus sText = Left(Me.txtNumberFilter.Text, Len(txtNumberFilter.Text) - 1) Me.txtNumberFilter.Value = sText Me.Filter = "[OrderNumber] Like '*" & sText & "*'" Me.FilterOn = True End If With Me.txtNumberFilter .SetFocus .Value = sText .SetFocus .SelStart = Len(sText) .SelLength = 0 End With Exit Sub ErrHandler: MsgBox Err.Description, vbExclamation End Sub
Wow, if I ever do figure this stuff out I will have a lot of clean up to I'll bet.
Thanks so much to you and all the others willing to help out a newbie trying to make his regular job easier!