you can use recordset for the purpose.

open a recordset from temp table and insert to temp2 table.
later if you want to delete the records from temp then go for it.

i have 2 table in my database access 1 is temporary and the second one is temporary2, how can i save all the data in temporary to temporary2? im using adodb.

try this code...

rs.Open "select * from temporary1", gcn

gcn.Execute "delete from temporary2"

If rs.RecordCount > 0 Then
    While Not rs.EOF()
        gcn.Execute "insert into temporary2(roll,name,address) values('" & rs!roll & "','" & rs!Name & "','" & rs!address & "')"
End If

If rs.State = adStateOpen Then rs.Close
Set rs = Nothing

where gcn is the connection and rs is the recordset object respectively....replace these with your objects....

check out the statement which is marked as red...this is the sql statement you need to modify according to the fields you have in your tables....this statement will extract one row from temporary1 table and insert it to temporary2 table...

hope this helps....get me a feedback if this works out...


This article has been dead for over six months. Start a new discussion instead.