473,748 Members | 8,773 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DAO Transaction Processing - What is it?

ADezii
8,834 Recognized Expert Expert
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 15063
NeoPa
32,571 Recognized Expert Moderator MVP
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
1246
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, *interesting* applications. Ideas? I'd be interested in up-to-date books, but other resources would be welcome as well. I am a VB.NET/ASP.NET person...(with a VB 6/ASP background) Thanks for any and all!
5
3343
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 definition? Thanks Klemens
15
10000
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-4 times and give up if after that it's still in deadlock. I'm very sure that many experienced people out there already deal with this issue somehow. Is there an alternative to it? Thanks for your comments and suggestions.
3
2716
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 the following code: Code: ------------------------------------------------------------------------------ -- ws.BeginTrans
0
1726
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 data generation, concurrent XML workloads (write-only, read-only and mixed), a workload driver to take measurements and more. Currently some things work on DB2 only, but will be extended to other systems later. The download of the TPoX package...
4
2057
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 actual charging information. 2 - Present the user with a summary of what he is about to purchase 3 - Give him the choice of card (via PayPal) or by check. 4 - If by check, go to a screen that he has to click the "Pay" button. 5 - After the...
0
1359
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. (2) The data generation now also produces XML fragments for "accounts". These are required by Update2 which inserts new accounts into existing custacc documents.
0
17536
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 used within the context of ADO (ActiveX Data Objects). Please refer to the Link below if you wish to see an Overview of Transaction Processing, how it is implemented within DAO, or special issues to be aware of when utilizing Transaction Processing in...
1
1987
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 specifically deals with database connection, manipulation, etc is resident in it's own standard module. I am using ADO and Access 2003 at the moment. I am wondering what the best method is to implement transaction processing. I have a method...
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9548
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.