Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creat a text Search

Status
Not open for further replies.

vilmarie

Programmer
Feb 10, 2004
41
PR
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!!!
 
The RowSource must contain the whole SELECT instruction, not just the WHERE clause.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top