I have a mini search tool where I have the users enter a client's name in a textbox and with each keystroke the record listing becomes more specified. The problem is when ever a user needs to enter a space in the search textbox the cursor just moves to the end of the word and hangs there. I entered my code in the textbox's Change event procedure:
Dim strClient As String
txtSearchClient.SetFocus
strClient = txtSearchClient.Text
If strClient <> "" Then
Me.RecordSource = "SELECT * FROM qryClientListing WHERE [ClientName] LIKE '" & strClient & "*'"
If Me.RecordsetClone.BOF = True And Me.RecordsetClone.EOF = True Then
MsgBox "No Records Found"
Me.RecordSource = "SELECT * FROM qryClientListing"
txtSearchClient.SetFocus
txtSearchClient.Text = ""
End If
Else
Me.RecordSource = "SELECT * FROM qryClientListing"
End If
txtSearchClient.SetFocus
txtSearchClient.SelStart = txtSearchClient.SelLength + 1
It works great for alphanumeric characters, but gets hosed with the space. Any helped would be much appreciated! Thanks!!!
Dim strClient As String
txtSearchClient.SetFocus
strClient = txtSearchClient.Text
If strClient <> "" Then
Me.RecordSource = "SELECT * FROM qryClientListing WHERE [ClientName] LIKE '" & strClient & "*'"
If Me.RecordsetClone.BOF = True And Me.RecordsetClone.EOF = True Then
MsgBox "No Records Found"
Me.RecordSource = "SELECT * FROM qryClientListing"
txtSearchClient.SetFocus
txtSearchClient.Text = ""
End If
Else
Me.RecordSource = "SELECT * FROM qryClientListing"
End If
txtSearchClient.SetFocus
txtSearchClient.SelStart = txtSearchClient.SelLength + 1
It works great for alphanumeric characters, but gets hosed with the space. Any helped would be much appreciated! Thanks!!!