"AG" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)