I have an unbound text box to filter records on a continuous form. I need to be able to type a string that includes spaces in the unbound text box. I type a space but a space is not inserted in the box.
Here is the code:
Here is the code:
Code:
Private Sub txtModelFilter_Change()
Dim strFilter As String
On Error GoTo ErrHandler
If Me.txtModelFilter.Text <> "" Then
strFilter = "[ModelNumber] Like '*" & Me.txtModelFilter.Text & "*'"
Me.Filter = strFilter
Me.FilterOn = True
Else
Me.Filter = ""
Me.FilterOn = False
End If
With Me.txtModelFilter
.SetFocus
.SelStart = Len(Me.txtModelFilter.Text)
End With
Exit Sub
ErrHandler:
MsgBox Err.Description, vbExclamation
End Sub