BeginTrans/CommitTrans/Rollback problems 
Author Message
 BeginTrans/CommitTrans/Rollback problems

I guess I must be a bonehead.  I spent some more time searching for information
on this problem and found an exact description of it in the Microsoft Knowledge
base at their web site.  The jist of the solution is to explicitly code a
DataBase.Close statement befor unloading the second maintenance form.  If you
don't, VB automatically executes as Database.Close and a Rollback (if a
transaction is active).  


Quote:

>I am using VB 3.0 and Access 2.0.  I have a Customer List form that allows you
>to double click on a Customer record and pops up a Customer Maintenance form
>that allows you to edit the record.  When you double-click the Customer List
>record I execute a sub whose first statement is BeginTrans.  (more text . . .)



Tue, 01 Sep 1998 03:00:00 GMT  
 BeginTrans/CommitTrans/Rollback problems

Quote:

>I am using VB 3.0 and Access 2.0.  I have a Customer List form that allows you
>to double click on a Customer record and pops up a Customer Maintenance form
>that allows you to edit the record.  When you double-click the Customer List
>record I execute a sub whose first statement is BeginTrans.  I have a Save and
>Cancel button on the Customer Maintenance form.  The Save button does an
>UpdateRecord on the Customer Data Control and then a CommmitTrans before
>unloading the form.  The Cancel button does an UpdateControls on the Customer
>Data Control and then a Rollback before unloading the form.  This works fine in
>this scenario.
>My problems arise when I have another list (Contacts for that Customer) on the
>Customer Maintenance.  Double-Clicking on a Contact brings up the Contact

Does this also call the sub that contains BeginTrans?

Quote:
>Maintenance form.  Save and Cancel buttons on this form work the same as on the
>Customer Maintenance form.  If I select a Customer and then select a Contact
>for Maintenance, I get an error 'Rollback without BeginTrans' if I select the
>Cancel button on each of the maintenance forms (Cancel Contact and then Cancel
>Customer).
>There is only one BeginTrans, CommitTrans and Rollback in all my code.
>It seems to me that somehow VB is forgetting that I have executed the
>BeginTrans statement.
>Can anyone tell me what is causing this?  I have read through the help text,
>the VB 3.0 manuals, the knowledge base's, searched the web, but have not been
>able to find any in depth information on using transactions in VB.  I assume
>this is because it works very easily for most people.  Is there something
>obvious that I am missing.  Help! Help! Help!
>    -Jim


--
Joel Cornell



Tue, 01 Sep 1998 03:00:00 GMT  
 BeginTrans/CommitTrans/Rollback problems
I am using VB 3.0 and Access 2.0.  I have a Customer List form that allows you
to double click on a Customer record and pops up a Customer Maintenance form
that allows you to edit the record.  When you double-click the Customer List
record I execute a sub whose first statement is BeginTrans.  I have a Save and
Cancel button on the Customer Maintenance form.  The Save button does an
UpdateRecord on the Customer Data Control and then a CommmitTrans before
unloading the form.  The Cancel button does an UpdateControls on the Customer
Data Control and then a Rollback before unloading the form.  This works fine in
this scenario.

My problems arise when I have another list (Contacts for that Customer) on the
Customer Maintenance.  Double-Clicking on a Contact brings up the Contact
Maintenance form.  Save and Cancel buttons on this form work the same as on the
Customer Maintenance form.  If I select a Customer and then select a Contact
for Maintenance, I get an error 'Rollback without BeginTrans' if I select the
Cancel button on each of the maintenance forms (Cancel Contact and then Cancel
Customer).

There is only one BeginTrans, CommitTrans and Rollback in all my code.

It seems to me that somehow VB is forgetting that I have executed the
BeginTrans statement.

Can anyone tell me what is causing this?  I have read through the help text,
the VB 3.0 manuals, the knowledge base's, searched the web, but have not been
able to find any in depth information on using transactions in VB.  I assume
this is because it works very easily for most people.  Is there something
obvious that I am missing.  Help! Help! Help!

        -Jim



Tue, 01 Sep 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. HELP ON BeginTrans-CommitTrans-Roolback

2. dbgrid() problem w.r.t begintrans, committrans, runtime error 3034

3. BeginTrans, CommitTrans problems

4. The use of BeginTrans/CommitTrans in several subs

5. (Q) Error# 3188 with BeginTrans/CommitTrans (Currently Locked by another session)

6. BeginTrans, CommitTrans, Rollback

7. how to write BeginTrans and CommitTrans in classes

8. BeginTrans and CommitTrans

9. HELP with VB 4.0 Standard / Access 7.0 - BeginTrans / CommitTrans

10. need help with transactions like begintrans ,committrans

11. Urgent help on Begintrans, rollback and commitTrans

12. BeginTrans, CommitTrans & Rollback

 

 
Powered by phpBB® Forum Software