473,387 Members | 3,810 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes and contribute your articles to a community of 473,387 developers and data experts.

DAO Transaction Processing - What is it?

ADezii
8,834 Expert 8TB
Transaction Processing is a Database term that 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 succeeds, or they all fail. A typical illustration of a Transaction is the transferring of data from one account to another in a banking application. You wouldn’t want your originating account debited a specific amount, have an error occur, and not have your ending account credited.

When referring to DAO Transactions, we will be dealing with 3 critical Methods of the Workspace Object. ADO Transactions, although very similar, will be covered in another Tip. These 3 Methods are briefly mentioned below:
  1. BeginTrans - marks the start of a series of operations that should be considered as a single, atomic unit.
  2. CommitTrans - takes everything since the most recent BeginTrans and writes it to disk.
  3. Rollback - the opposite of CommitTrans; it undoes all your changes back to the last CommitTrans. The critical word here is all.
In its basic, sketal format, DAO Transaction Processing looks something like this:
Expand|Select|Wrap|Line Numbers
  1. On Error GoTo Err_Handler
  2.  
  3. Dim wrkCurrent As DAO.Workspace
  4. Dim blnInTrans As Boolean      'are we in a Transaction?
  5.  
  6. blnInTrans = False      'not in a Transaction yet
  7. Set wrkCurrent = DAO.DBEngine.Workspaces(0)
  8. '...
  9.  
  10. wrkCurrent.BegingTrans
  11. blnInTrans = True      'presently in a Transaction
  12.  
  13. 'make all data modifications/changes here
  14.  
  15. wrkCurrent.CommitTrans
  16. blnInTrans = False      'changes committed without an Error, Transaction is complete
  17.  
  18. '...
  19. Err_Handler:
  20.   If blnInTrans Then      'was the Transaction successfully completed, or does it need to be Rolled back?
  21.     wrkCurrent.Rollback
  22.   End If
  23.   'continue Error Processing if necessary
Several issues when using DAO Transaction Processing:
  1. Not all Recordsets support Transaction Processing. Check the Transactions Property of a Recordset to see whether it supports Transaction Processing.
  2. Transactions affect all changes to data in the Workspace.
  3. You can nest Transactions in Jet Databases up to 5 levels deep. Inner Transactions must be committed or rolled back before the surrounding ones.
  4. If you close a Workspace without explicitly committing its transactions, all pending Transactions are automatically rolled back.
Jul 1 '07 #1
1 15025
NeoPa
32,556 Expert Mod 16PB
A question related to this was posted and can be found at Transactions - Error Handler.
Jun 18 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: JJ_377 | last post by:
I need some suggestions on resources for learning about transaction processing. I have an excellent SQL reference that gives the syntax...and basic concepts but I am also interested in real world,...
5
by: Klemens | last post by:
I get SQL30090 reason 18 by trying to do an insert in a federated table and an update in a local table in one transaction Do I have to change some settings to get done or ist this not possible by...
15
by: Zeng | last post by:
Hi, The bigger my C# web-application gets, the more places I need to put in the tedious retrying block of code to make sure operations that can run into database deadlocks are re-run (retried)...
3
by: rdemyan via AccessMonster.com | last post by:
I have some unbound forms that I want to use transaction wrappers on when updating the table. My question is on the scope of what transaction processing will do. I'm going to keep it simple with...
0
by: ikogan | last post by:
The first release of the Transaction Processing over XML (TPoX) database benchmark took place last week! Please take a look at tpox.sourceforge.net. The benchmark consists of XML schemas, XML...
4
by: Shelly | last post by:
I am looking for some advice on the design of a transaction processing sequence. As I xcurrently have it, the sequence is as follows: 1 - Gather all the information from the user other than the...
0
by: ikogan | last post by:
In January, I announced our TPoX benchmark that became public on tpox.sourceforge.net. We just had its next release. What is new? (1) TPoX 1.1 contains six sub-document XML level updates. ...
0
ADezii
by: ADezii | last post by:
In the Tip of the Week #19, we demonstrated Transaction Processing, specifically as it applies to DAO (Data Access Objects). In this week's Tip, we'll illustrate how Transaction Processing can be...
1
by: Terry VanDamme | last post by:
Hello, I am attempting to write an application where I have code segregation where code dealing with the form is located in the form which relies on a class module (ie clsOrders) and all code that...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.