Hi everyone
As many of you probably know I have a datasheet (split form) and a search bar that filters the datasheet based on whatever the user types in. It works nicely so far and the vba for the search is as follows:
Code:
Option Compare Database
Option Explicit
Private Sub cmdReset_Click()
Me.txtSearch = ""
Me.SrchText = ""
DoCmd.Requery
Me.txtSearch.SetFocus
End Sub
Private Sub SrchText_AfterUpdate()
Me.SrchText.Requery
End Sub
Private Sub txtSearch_Change()
'Create a string (text) variable
Dim vSearchString As String
vSearchString = txtSearch.Text
SrchText.Value = vSearchString
If Len(Me.SrchText) <> 0 And InStr(Len(SrchText), SrchText, " ", vbTextCompare) Then
Exit Sub
End If
'Me.SearchResults = Me.SearchResults.ItemData(1)
'Me.SearchResults.SetFocus
DoCmd.Requery
Me.txtSearch.SetFocus
If Not IsNull(Len(Me.txtSearch)) Then
Me.txtSearch.SelStart = Len(Me.txtSearch)
End If
End Sub
the datasheet comes with built-in text filtering options which is nice however I noticed when I used it to filter records, then cleared the filter options, the search bar no longer worked. Can this be fixed? Should I avoid the text filtering options altogether? Or can this be still used without disrupting the search bar? Thank you!