Hi
I create a stock Management database. Table name is StockManagement. Form name is Stock Managment. In the form, I'm trying to create a search button for searching any words in Descriptions field. Code is as follows,
However, it does not work for me. I don't know what is missing from it.
I create a stock Management database. Table name is StockManagement. Form name is Stock Managment. In the form, I'm trying to create a search button for searching any words in Descriptions field. Code is as follows,
Code:
Private Sub cmSearch_Click()
Dim LSQL As String
Dim LSearchString As String
If Len(txtSearchString) = 0 Or IsNull(txtSearchString) = True Then
MsgBox "You must enter a search string."
Else
LSearchString = txtSearchString
'Filter results based on search string
LSQL = "select * from Stock Management"
LSQL = LSQL & " where Descriptions LIKE '*" & LSearchString & "*'"
'Clear search string
txtSearchString = ""
MsgBox "Results have been filtered. All Descriptions containing " & LSearchString & "."
End If
End Sub
However, it does not work for me. I don't know what is missing from it.