1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| Private Sub Commande7_Click()
Dim oRst As DAO.Recordset
Dim oDb As DAO.Database
Dim index As Integer
Set oDb = CurrentDb
Set oRst = oDb.OpenRecordset("matable", dbOpenTable)
CurrentDb.Execute ("DELETE * FROM matable;") 'Suppression des données existantes
index = 1
While index < 601
oRst.AddNew 'Passe en mode Ajout
oRst.Fields("ref").Value = CStr(index) 'Affecte le champ
oRst.Update 'Met à Jour
index = index + 1
Wend
'Libération des objets
oRst.Close
oDb.Close
Set oRst = Nothing
Set oDb = Nothing
End Sub |
Partager