Move Records to another table

message from Techsupport on 18 May 2004
Hello, all,

How can I move records from one table to another programmatically?

Thanks,

Antonio
 
Allen Browne replied to Techsupport on 19 May 2004
A move consists of a copy followed by a delete.

Typically this is a pair of action query statements, e.g.:
With dbEngine(0)(0)
.Execute "INSERT INTO ...
.Execute "DELETE FROM ...
End With

The dbFailOnError switch will prevent the DELETE from executing if the
INSERT does not complete, but still leaves you with inconsistent results. A
transaction lets you roll the entire operation back if something does not go
correctly (e.g. if a user or process has a record locked that you are trying
to move.)

Details on the traps and solutions for transactions in article:
Archive: Move records to another table
at:
http://allenbrowne.com/ser-37.html
 
Techsupport replied to Allen Browne on 19 May 2004
Thank you, Allen...I have one more question: if I run the Append query and
I don't run the Delete query, is it normal to get an error message stating
that it can't append? Thanks, Antonio

"Allen Browne" <AllenBrowne@SeeSig.Invalid> wrote in message
news:40aac621$0$16598$5a62ac22@freenews.iinet.net.au...
 
Allen Browne replied to Techsupport on 19 May 2004
If there is a reason why records cannot be appended, you get no error with
the Execute method unless you use dbFailOnError.

With RunSql, it depends whether SetWarnings is on as to whether you get the
confirmation message.
 
Techsupport replied to Allen Browne on 19 May 2004
Thank you, Allen

news:40ab74e2$0$27712$afc38c87@...
 

Archived message: Move Records to another table (MS Access Database)