Commit or Rollback without BeginTrans Error 
Author Message
 Commit or Rollback without BeginTrans Error

I have two data controls on a form. Data1 binds the primary table and
Data2 binds the related rows from another table.

There is a BeginTrans statement in the Reposition event of Data1 and a
CommitTrans statement in the Validate event.  The form also has a
button which contains a Rollback statement in the Click event.  (Is
this reasonable?  Is this a good way to offer the user ability to undo
edits?)

If I perform Data2.Refresh, the next time a CommitTrans or Rollback is
performed then an error occurs: "Commit or Rollback without
BeginTrans".  Why is this so?  Is this because the transaction buffer
has been automatically closed by the Refresh method?  Can I avoid it
doing so? Can I examine the transaction buffer or its status?

Please note that I am using Access v1.1. Many thanx.  wm



Thu, 09 Oct 1997 03:00:00 GMT  
 Commit or Rollback without BeginTrans Error
My previous post may not be altogether clear as a bell.  The point is
I haven't (explicitly) performed a CommitTrans or Rollback.  The
sequence of events is:

1) Record repositions and thus BeginTrans performed.
2) Data2.Refresh
3) Issue CommitTrans or Rollback
4) "CommitTrans or Rollback without BeginTrans" Error occurs

It is the *first* CommitTrans or Rollback following the BeginTrans
that causes the error.  It seems that Data2.Refresh is closing the
transaction without my explicit intention.  Is this right? Can I avoid
it doing so? Please discuss.

Should I not attempt to use BeginTrans etc on a form to provide undo
capability in this fashion?



Sat, 11 Oct 1997 03:00:00 GMT  
 Commit or Rollback without BeginTrans Error

Quote:

>I have two data controls on a form. Data1 binds the primary table and
>Data2 binds the related rows from another table.
>There is a BeginTrans statement in the Reposition event of Data1 and a
>CommitTrans statement in the Validate event.  The form also has a
>button which contains a Rollback statement in the Click event.  (Is
>this reasonable?  Is this a good way to offer the user ability to undo
>edits?)
>If I perform Data2.Refresh, the next time a CommitTrans or Rollback is
>performed then an error occurs: "Commit or Rollback without
>BeginTrans".  Why is this so?  Is this because the transaction buffer
>has been automatically closed by the Refresh method?  Can I avoid it
>doing so? Can I examine the transaction buffer or its status?
>Please note that I am using Access v1.1. Many thanx.  wm

A better way of creating undo is to use the UpdateControls method of the data
control.  This will update any bound controls with the contents of the record
in the database which remains unchanged until you move the record pointer or
use the update method.

Peter Walsh
Research and Development
Land Information Bureau
Department of Environment and Land Management   Phone: 61 (03) 336 815
GPO Box 510E Hobart Tasmania 7001 Australia        Fax: 61 (03) 333 717



Sun, 12 Oct 1997 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VB4 - Commit or Rollback without BeginTrans. (Error 3034)

2. VB4 - Commit or Rollback without BeginTrans. (Error 3034)

3. BeginTrans Commit RollBack

4. BeginTrans, Commit, RollBack

5. BeginTrans|Commit|Rollback

6. Begintrans/Commit/Rollback

7. VB3 err:Commit or RollBack without BeginTrans, but the BeginTrans is there!

8. "CommitTrans (or Rollback) without BeginTrans"

9. Nested BeginTrans/Rollback stmt error - need help

10. Commit and Rollback error

11. BeginTrans, Rollback Question with query.

12. BeginTrans, CommitTrans, Rollback

 

 
Powered by phpBB® Forum Software