What is Error 3034: You tried to commit or roll back, etc.?

P

pastoral80

I have a real estate appraisal program which uses Access 97 databases. Every
so often I get a message, "Error 3034: You tried to commit or roll back a
transaction without first using BeginTrans." What does this mean and how can
I correct this?
 
A

Allen Browne

When a developer wants to make several changes to the data with an all or
nothing result, they wrap them in a transaction. For example, if you wanted
to debit one bank and credit another, but the first operation cannot be
allowed to succeed if the second one fails, you would wrap them in a
transaction. You can then commit the transaction, or roll it back if there
is a problem.

If the code comes to a RollBack or CommitTrans when no transaction is
running, it throws error 3034. The error typically indicates faulty
programming. It is not difficult for a developer to get this wrong. There
are several traps, discussed in this article:
Archive: Move records to another table - move + delete in a transaction
at:
http://allenbrowne.com/ser-37.html

In a bound form, Access itself uses transactions for things like deleting a
record, so it is possible that the error is triggered by interrupting
something else.
 
P

pastoral80

Thanks very much Allen!

Allen Browne said:
When a developer wants to make several changes to the data with an all or
nothing result, they wrap them in a transaction. For example, if you wanted
to debit one bank and credit another, but the first operation cannot be
allowed to succeed if the second one fails, you would wrap them in a
transaction. You can then commit the transaction, or roll it back if there
is a problem.

If the code comes to a RollBack or CommitTrans when no transaction is
running, it throws error 3034. The error typically indicates faulty
programming. It is not difficult for a developer to get this wrong. There
are several traps, discussed in this article:
Archive: Move records to another table - move + delete in a transaction
at:
http://allenbrowne.com/ser-37.html

In a bound form, Access itself uses transactions for things like deleting a
record, so it is possible that the error is triggered by interrupting
something else.
 

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