Ciao,
se vuoi inserire records in una tabella, l'istruzione con una stringa Sql….
O così:
DBEngine(0)(0).Execute "INSERT INTO TuaTabella (Campo1, Campo2, ...) VALUES (Dato1, Dato2, ...)"
oppure così:
CurrentDb.Execute "INSERT INTO TuaTabella (Campo1, Campo2, ...) VALUES (Dato1, Dato2, ...)"
Invece con ADODB Recordset cosa volevi fare ?
Public Sub con()
Dim conn As ADODB.Connection
Set conn = New ADODB.Connection
Dim rst As ADODB.Recordset
Set rst = New ADODB.Recordset
conn.ConnectionString = "Provider=vfpoledb;Data Source=C:\Archivi\;Collating Sequence=machine;"
conn.Mode = adModeReadWrite
conn.Open
rst.CursorLocation = adUseClient
rst.CursorType = adOpenStatic
rst.LockType = adLockBatchOptimistic
rst.Open "tabella", conn, , , adCmdTableDirect
' esempio...............
Do While Not rst.EOF
DBEngine(0)(0).Execute "INSERT INTO TuaTabella (Campo1, Campo2, ...) " & _
"VALUES (" & rst.Fields(Dato1) & ", " & rst.Fields(Dato2) & ", " ...);"
rst.MoveNext
Loop
' ......................
rst.Close
Set rst = Nothing
conn.Close
Set conn = Nothing
End Sub