Hello:
I have a search box in my access form, with this code behind it (not the cleanest code, I copied it from somewhere...suggestions for improvement are welcome):
Private Sub txtFindShopOrder_AfterUpdate()
Dim strFilter As String, strOldFilter As String
strOldFilter = Me.Filter
'txtFindAccountCode - Text
If Me!txtFindShopOrder > "" Then _
strFilter = strFilter & _
" AND ([Shop Order] Like '" & _
Me!txtFindShopOrder & "*')"
If strFilter > "" Then strFilter = Mid(strFilter, 6)
If strFilter <> strOldFilter Then
Me.Filter = strFilter
Me.FilterOn = (strFilter > "")
End If
Me!txtFindShopOrder.Value = Null
End Sub
Now, I want this code to be able to search any part of the string. For example, lets say there is a record in the table "15W1234"...the search box will return an empty value if I searched for "1234", it will only display the needed records when I type the search criteria from the beginning, i.e. "15W1"....What do I need to add/change to code to make this work..
Thanks for your help....!
I have a search box in my access form, with this code behind it (not the cleanest code, I copied it from somewhere...suggestions for improvement are welcome):
Private Sub txtFindShopOrder_AfterUpdate()
Dim strFilter As String, strOldFilter As String
strOldFilter = Me.Filter
'txtFindAccountCode - Text
If Me!txtFindShopOrder > "" Then _
strFilter = strFilter & _
" AND ([Shop Order] Like '" & _
Me!txtFindShopOrder & "*')"
If strFilter > "" Then strFilter = Mid(strFilter, 6)
If strFilter <> strOldFilter Then
Me.Filter = strFilter
Me.FilterOn = (strFilter > "")
End If
Me!txtFindShopOrder.Value = Null
End Sub
Now, I want this code to be able to search any part of the string. For example, lets say there is a record in the table "15W1234"...the search box will return an empty value if I searched for "1234", it will only display the needed records when I type the search criteria from the beginning, i.e. "15W1"....What do I need to add/change to code to make this work..
Thanks for your help....!