Thomas,
I have to ask. Where did you read about transactions? I can't remember ever
seeing a book, magazine, or help article that didn't include some sample
code. Did you experiment with the code that was with the article you read?
There is no better way to learn code techniques than to step through sample
code.
That said, why are you looking at ADO? If you are using Jet (mdb file)
tables, you should be using DAO. DAO was created for Jet. Although ADO can
be used with Jet, it was designed for non-Jet data sources like SQL Server,
Oracle, MySQL, etc. In fact, you'll find that DAO transactions have
capabilities that ADO transactions don't have.
To answer your question about how you know a transaction was successful, you
don't. A transaction doesn't succeed or fail. A transaction is a wrapper
around individual actions (update, delete, append, etc.) that succeed or
fail. The transaction wrapper allows you to commit the changes or restore
(rollback) the data. You typically use error trapping to determine if an
operation in the transaction failed.
I have several examples of running update queries in transactions in my
November 2005 presentation that I make to the Denver Area Access Users
group. You can get the files from my website at
http://www.scobiz.com/. Look
for presentations on the left side. I started the presentation using
DoCmd.OpenQuery which can not be used in transactions and then I progress to
examples of using database.Execute. Some of the examples succeed with a
commit and some fail with a rollback. You will find a Word document in the
download that has instructions on how to run the demos.
Although the demos update different fields in the same table, the techniques
work the same using different tables.
The sample database is in 2000 format, so it will work in Access 2000, 2002,
and 2003 with no modifications.
I suggest you spend some time studying the transaction keyword sections in
the DAO help file.
Good luck.
Sco
M.L. "Sco" Scofield, MCSD, MCP, MSS, A+, ex-MVP
Denver Area Access Users Group 2006 President
www.DAAUG.org
MS Colorado Events Administrator
www.MSColoradoEvents.com
Useful Metric Conversion #19 of 19: 2 wharves = 1 paradox
Miscellaneous Access and VB "stuff" at
www.ScoBiz.com