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
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