Hi,
this is the code i am using
Private Sub CommandButton1_Click()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim r As Long
con.Open "Provider=Microsoft.Jet.Oledb.4.0; " & _
"data Source=C:\Documents and Settings\Administrator\Desktop\db1.mdb;"
rs.Open "tbl_name", con, adOpenKeyset, adLockOptimistic, adCmdTable
r = 6
Do While Len(Sheet1.Range("A" & r).Formula) > 0
With rs
.AddNew
.Fields("NAME") = Sheet1.Range("B" & r).Value
.Update
End With
r = r + 1
Loop
rs.Close
Set rs = Nothing
con.Close
Set con = Nothing
End Sub
Bookmarks