Ti posto un esempio in ADO, copia i record presenti in una tabella in un'altra con uguale struttura. Manca la gestione degli errori:
codice:
Private RS As New ADODB.Recordset, RS1 As New ADODB.Recordset
'Command Button su form
Private Sub Command1_Click()
If RS.State = 1 Then RS.Close
RS.CursorLocation = adUseClient
RS.Open ("Select * from TabellaPrincipale"), Db, adOpenKeyset, adLockOptimistic
Do Until RS.EOF
If RS1.State = 1 Then RS1.Close
RS1.CursorLocation = adUseClient
RS1.Open ("select * from TabellaSecondaria Where Chiave = " & RS("Chiave")& " "), Db, adOpenKeyset, adLockOptimistic
If RS1.EOF Then
RS1.AddNew
For Each FldRS In RS.Fields
RS1(FldRS.Name) = RS(FldRS.Name)
Next
RS1.Update
End If
RS1.Close
RS.MoveNext
Loop
RS.Close
End Sub
Non L'ho provata spero di non aver fatto errori. Ciao