Article ID: 223213 - Last Review: June 23, 2005 - Revision: 3.0 ACC2000: Error Using CurrentProject.Connection in Transactions
This article was previously published under Q223213 Advanced: Requires expert coding, interoperability, and multiuser skills.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp). On This PageSYMPTOMS
If you use the CommitTrans or RollbackTrans methods directly with the CurrentProject.Connection object, you may receive one of the following errors:
You tried to commit or rollback a transaction without first beginning a transaction.
-or-
No transaction is active.
CAUSE
Each time the CurrentProject.Connection object is used, it has a different pointer to the connection. In effect, the instance or pointer to that object is temporary. This is why you see no error on CurrentProject.Connection.BeginTrans, but you do receive an error once you try to commit or rollback the transaction.
RESOLUTIONMicrosoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements. CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database. Set an object variable once to CurrentProject.Connection and use it for your transaction processing, such as in the following example. Here, "c" is the Connection object used for transactions: NOTE: The sample code in this article uses Microsoft ActiveX Data Objects. For this code to run properly, you must reference the Microsoft ActiveX Data Objects 2.x Library (where 2.x is 2.1 or later.) To do so, click References on the Tools menu in the Visual Basic Editor, and make sure that the Microsoft ActiveX Data Objects 2.x Library check box is selected.
MORE INFORMATIONSteps to Reproduce Behavior
| Other Resources Other Support Sites
CommunityGet Help NowArticle Translations
|





















Back to the top