Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21251

Word Search with access data base

$
0
0
Hi there,
Can somebody help me please, i'm having some problem with my code. I'm trying to make a word search with access as database. I have 2 textboxes (txtproductcode and txtproductdescription), I also have a listview (lvproduct).

With the txtproductcode I have no problem it is working just fine. But with txtproductdescription what im trying to do is if I for example type "Ball or ball" listview will list all products with the word Ball or ball.

As for the txtproductcode here is my code if you dont mind.

Code:

Private Sub txtproductcode_Change()
lvproduct.ListItems.Clear
Connection

sql = "SELECT * FROM product WHERE code LIKE '" & Trim(txtproductcode.Text) & "%'"
Set rs = New ADODB.Recordset
rs.Open sql, Conn, adOpenDynamic, adLockOptimistic
If Not rs.EOF Then
Do Until rs.EOF
    Set lst1 = lvproduct.ListItems.Add(, , rs!code)
        With lst1
            .SubItems(1) = rs!erb
            .SubItems(2) = rs!Description
            .SubItems(3) = rs!enterby
            .SubItems(4) = rs!casesize
            .SubItems(5) = rs!unitsize
            .SubItems(6) = rs!category
            .SubItems(7) = rs!subcategory

        End With
    rs.MoveNext
Loop
End If
rs.Close: Set rs = Nothing
End Sub


And for the Listview:
Code:

Private Sub lvproduct_Click()
    productcode = lvproduct.SelectedItem.Text

End Sub

MS Access: database
Tables: code, productdescription


Hope you guys can hep me out.

More Power,
Chino :)

Viewing all articles
Browse latest Browse all 21251

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>