Connecting Tech Pros Worldwide Forums | Help | Site Map

transactions

Newbie
 
Join Date: Nov 2007
Posts: 2
#1: Nov 8 '07
Having some problems with transactions using Access 2007.

I have a table called test with just one column named 'field' which is numeric.

Why does the following work:

Expand|Select|Wrap|Line Numbers
  1.   Set ws = DBEngine(0)
  2.   Set db = ws(0)
  3.  
  4.   ws.BeginTrans
  5.  
  6.       strSql = "INSERT INTO test VALUES(3)"
  7.       db.Execute strSql, dbFailOnError
  8.  
  9.   ws.Rollback
  10.  
But the following does NOT:

Expand|Select|Wrap|Line Numbers
  1.   Set ws = DBEngine(0)
  2.   Set db = ws(0)
  3.  
  4.   ws.BeginTrans
  5.       DoCmd.OpenForm "test1", acNormal, "", "", , acDialog
  6.   ws.Rollback
  7.  
where test1 is just a continous form generated from table test using the wizard.

It seems that the chages mad are successfully rolled back in the first snippet but not in the second. Obviously there is something I don't understand about Access. Thanks for all/any help.

ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,218
#2: Nov 8 '07

re: transactions


Quote:

Originally Posted by bahadur

Having some problems with transactions using Access 2007.

I have a table called test with just one column named 'field' which is numeric.

Why does the following work:

Expand|Select|Wrap|Line Numbers
  1.   Set ws = DBEngine(0)
  2.   Set db = ws(0)
  3.  
  4.   ws.BeginTrans
  5.  
  6.       strSql = "INSERT INTO test VALUES(3)"
  7.       db.Execute strSql, dbFailOnError
  8.  
  9.   ws.Rollback
  10.  
But the following does NOT:

Expand|Select|Wrap|Line Numbers
  1.   Set ws = DBEngine(0)
  2.   Set db = ws(0)
  3.  
  4.   ws.BeginTrans
  5.       DoCmd.OpenForm "test1", acNormal, "", "", , acDialog
  6.   ws.Rollback
  7.  
where test1 is just a continous form generated from table test using the wizard.

It seems that the chages mad are successfully rolled back in the first snippet but not in the second. Obviously there is something I don't understand about Access. Thanks for all/any help.

Transaction Processing refers to the process of grouping changes to your data into a Batch that is treated as a single atomic unit. Either the entire Batch of Transactions succeed, or they all fail. To put it simple, you have taken the term totally out of context, you cannot Rollback the opening of a Form.
Newbie
 
Join Date: Nov 2007
Posts: 2
#3: Nov 8 '07

re: transactions


Quote:

Originally Posted by ADezii

Transaction Processing refers to the process of grouping changes to your data into a Batch that is treated as a single atomic unit. Either the entire Batch of Transactions succeed, or they all fail. To put it simple, you have taken the term totally out of context, you cannot Rollback the opening of a Form.

Sorry if I confused people. But I was not expecting the opening of the form to be rolled back - but just any changes to the (underlying) table made via the form e.g. deletes, inserts, updates ....

I hope that clarifies my question.
ADezii's Avatar
Expert
 
Join Date: Apr 2006
Location: Philadelphia
Posts: 5,218
#4: Nov 8 '07

re: transactions


Quote:

Originally Posted by bahadur

Sorry if I confused people. But I was not expecting the opening of the form to be rolled back - but just any changes to the (underlying) table made via the form e.g. deletes, inserts, updates ....

I hope that clarifies my question.

To the best of my knowledge, the response is still the same. You cannot Rollback changes made to data via a Form interface,
Reply