1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| Private Sub Commande102_Click()
'Création des 2 recordsets
Dim myRS1 As New ADODB.Recordset
Dim myRS2 As New ADODB.Recordset
myRS1.Open "Sorti Matériel", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
myRS2.Open "Table", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
'Parcours du RS pour ajouter à table1 tout en supprimant de table2
Do Until myRS2.EOF
With myRS1
.AddNew Array("N° garage", "Carte grise", "Site"), _
Array(myRS2("N° garage"), myRS2("Carte grise"), myRS2("Site"))
.Update
End With
myRS2.Delete
myRS2.MoveNext
Loop
'Fermeture des recordsets
myRS1.Close
myRS2.Close
Set myRS1 = Nothing
Set myRS2 = Nothing
End Sub |
Partager