DAO Workspace in Access 2007

D

Dirk Goldgar

AG said:
According to KB article http://support.microsoft.com/kb/928025/en-us
A DAO Workspace can not be created in Access 2007.
How can a DAO operaton be wrapped in a transaction so that it can be
rolled back in case of failure, since transaction operations are Workspace
methods?


You can't *create* a workspace object, apparently, but you can use the
existing one that Access is using. For example:

Dim ws As DAO.Workspace

Set ws = DBEngine.Workspaces(0)

ws.BeginTrans

ws(0).Execute _
"INSERT INTO Table1 (TextField) VALUES('Transaction')", _
dbFailOnError

If MsgBox("Commit this update?", vbYesNo, "Commit?") _
= vbYes _
Then
ws.CommitTrans
Else
ws.Rollback
End if

Set ws = Nothing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top