Yes...

By Onur Tosyali

Access VBA using transactions

So easy, so useful...
Dim ws As DAO.Workspace
Set ws = DBEngine.Workspaces(0)
ws.BeginTrans
'Do all update/insert query executions here
'CurrentDb.Execute(...) etc.
ws.CommitTrans (or .Rollback)
ws.Close

--- Here, wksp.CommitTrans will commit the queries between BeginTrans and CommitTrans.
--- Unless CommitTrans is called, no change in your data will take place.
--- ws.RollBack will cancel previous actions in the transaction, and transaction is free to be filled again.

No comments:

Post a Comment