In this code you must type the complete word in the textbox that stored in ur table to shows up in the listview.
any1 can help me with this?? it should be base by letters not word.

Private Sub ListView1_click()
Dim rs As New ADODB.Recordset
Dim selected As String


If ListView1.SelectedItem Is Nothing Then

Else

selected = ListView1.SelectedItem

 rs.Open "select  *FROM books  wHERE title like '" & selected & "'", cnn, adOpenStatic, adLockPessimistic
    If rs.RecordCount <> 0 Then
    Text8 = rs!Title

    End If
    End If



End Sub






 Private Sub Text12_Change()



    Dim rs As New ADODB.Recordset
    Dim Item As ListItems


    rs.Open "select * from books where title like '" & Text12 & "' ", cnn, adOpenStatic, adLockPessimistic

    ListView1.ListItems.Clear

    While Not rs.EOF

    ListView1.ListItems.Add , , rs!Title
    ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs!accesionno
    ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs!quantity
    ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs!dateAcquired
    ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs!Value
    ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs!conditions
    ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs!code
    ListView1.ListItems(ListView1.ListItems.Count).ListSubItems.Add , , rs!author


    rs.MoveNext
    Wend





    End Sub

Edited 4 Years Ago by klars247: add words

Hi,

You have to use "%" around the text like this....

rs.Open "select * from books where title like '%" & Text12 & "%' ", cnn, adOpenStatic, adLockPessimistic

Regards
Veena

This question has already been answered. Start a new discussion instead.