I need to create a text box that I enter any word and show me in a listbox all the record that the first letter is thge word that I enter in the text. I write the following code:
Private Sub cmdSearch_Enter()
Dim strFilter As String
Dim strSQL As String
If IsNull(Me.txtSearch) Or Me.txtSearch.Value = " " Then
MsgBox " Please enter a Title", vbExclamation, "System Library Message"
Me.txtSearch.SetFocus
Else
If Not IsNull(Me!txtSearch) Then strFilter = strFilter & "[Title] Like " & Chr(34) & "*" & Me!txtSearch & "*" & Chr(34) & " AND "
If strFilter <> "" Then strFilter = Left$(strFilter, Len(strFilter) - 5)
Me!lstSearch.RowSource = strFilter
Me!lstSearch.Requery
End If
End Sub
But this not result. How I can resolved these? Thanks!!!
Private Sub cmdSearch_Enter()
Dim strFilter As String
Dim strSQL As String
If IsNull(Me.txtSearch) Or Me.txtSearch.Value = " " Then
MsgBox " Please enter a Title", vbExclamation, "System Library Message"
Me.txtSearch.SetFocus
Else
If Not IsNull(Me!txtSearch) Then strFilter = strFilter & "[Title] Like " & Chr(34) & "*" & Me!txtSearch & "*" & Chr(34) & " AND "
If strFilter <> "" Then strFilter = Left$(strFilter, Len(strFilter) - 5)
Me!lstSearch.RowSource = strFilter
Me!lstSearch.Requery
End If
End Sub
But this not result. How I can resolved these? Thanks!!!