ad button for different rows after searcing in database

T

tsumiki

dear all,

i have a problem to add buttons with different rows after user type
keyword to search records in Access database. Button will be added an
point to the unique vid.

the searching function works but i don't know how to add row button
for user to click the differenct records. Pls help!!!

here is the code:
Private Sub CommandButton1_Click()

Dim rst As New ADODB.Recordset
rst.ActiveConnection = _
" Provider=Microsoft.Jet.OLEDB.4.0;" & _
" Data Source=d:\db1.mdb"

keyword = Trim(TextBox1.Text)
If keyword <> " " Then
strSQL = " SELECT * From summary WHERE v_id LIKE '%" & keyword
"%' " & _
"OR v_name LIKE '%" & keyword & "%' " & _
"OR t_size LIKE '%" & keyword & "%' " & _
"OR r_rate LIKE '%" & keyword & "%' Order By v_id Asc"

rst.Open strSQL
Range("A8..J100").Clear
Range("A8").Select

Do While Not rst.EOF()
For k = 0 To 4
ActiveCell.Offset(0, k).Value = rst.Fields(k)
Next
ActiveCell.Offset(1, 0).Select
rst.MoveNext
Loop
rst.Close
End If
End Sub


thanks,
tsum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top