1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Private Sub CommandButton2_Click()
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
con.ConnectionString = "Driver=(Microsoft Access Driver(*.mdb)); " & "DBQ=C:\Documents and Settings\pika\Bureau\Nouveau dossier\tbl_name.mdb;"
con.Open
Set rs.ActiveConnection = con
rs.Open " SELECT*FROM tbl_name"
StartRow = 2
Do Until rs.EOF
Cells(StartRow, 3) = rs.Fields(0).Value
rs.MoveNext
StartRow = StartRow + 1
Loop
rs.Close
Set rs = Nothing
con.Close
Set con = Nothing
End Sub |
Partager