Need to rollback the SQL DELETE statement (1 Viewer)

polina

Registered User.
Local time
Today, 12:01
Joined
Aug 21, 2002
Messages
100
Hi,

At some point in my program I do delete everything from one table and then copy records from another to that table again...

DoCmd.RunSQL ("DELETE * FROM tblFIFROLL")

DoCmd.RunSQL ("SELECT tblFIFROLL1.*, * INTO tblFIFROLL FROM tblFIFROLL1")

If hit ESC while the second SQL statements executes, I loose my tblFIFROLL, I mean the table itself is deleted, not only the records from it.

PLEASE, advise how to rollback the DELETE if error happends during the execution of SELECT statement. Or advise any other effecient method on performing the DELETE and INSERT tasks with the tables.

I'll appreciate your help.

Thanks.
 

BarkerD

Registered User.
Local time
Today, 12:01
Joined
Dec 1, 1999
Messages
106
What you need to do is use a transaction. For an example of how to write transaction code, look at this thread.

Transaction Example

Hope this will help.
 

Users who are viewing this thread

Top Bottom