Hello everyone,
I have a datasheet in split-form view and a search bar that filters based on whatever the user types in and I'm happy to say works very well. I have attached the SQL of the query this datasheet uses. So as you can see from the screenshot whatever the user types in is based on those columns in the WHERE clause. But to take it a little further, program codes (e.g. 2010) and dates 1/2/2010 can conflict, because for example if i need to find all the records with the program code "2010", i might not get all of them since the query look for records with "2010" in it's date field as well. Is there anyway I can maybe add a second search bar that filters by programs only? The VBA for the search bar is as follows:
Any help is much appreciated.
I have a datasheet in split-form view and a search bar that filters based on whatever the user types in and I'm happy to say works very well. I have attached the SQL of the query this datasheet uses. So as you can see from the screenshot whatever the user types in is based on those columns in the WHERE clause. But to take it a little further, program codes (e.g. 2010) and dates 1/2/2010 can conflict, because for example if i need to find all the records with the program code "2010", i might not get all of them since the query look for records with "2010" in it's date field as well. Is there anyway I can maybe add a second search bar that filters by programs only? The VBA for the search bar is as follows:
Code:
Private Sub cmdReset_Click()
Me.txtSearch = ""
Me.SrchText = ""
Me.txtSearch.SetFocus
DoCmd.Requery
End Sub
Private Sub Form_Load()
DoCmd.GoToRecord , , acNewRec
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
Any help is much appreciated.