473,395 Members | 1,919 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Transactions - No transaction when rollback

Hello and TIA,

I am trying to write some VB code to move some data between 2 Access
databases using a code module in Access. As part of it, I am trying to
use transactions.

However, by the time I get to the commit or rollback statements it no
longer recognizes the transaction. What am I doing wrong?

on error goto errhandler
CurrentProject.Connection.BeginTrans
CurrentProject.Connection.Execute "update checklist_item set comment =
'transaction test' where checklist_item_id = 5127"
' CurrentProject.Connection.CommitTrans
CurrentProject.Connection.RollbackTrans

errhandler:
MsgBox Error(err.number)

the message I get is always the same.
"You have tried to commit or rollback a transaction without first
beginning a transaction"

May 4 '06 #1
2 4153
campbell_canuck wrote:
Hello and TIA,

I am trying to write some VB code to move some data between 2 Access
databases using a code module in Access. As part of it, I am trying to
use transactions.

However, by the time I get to the commit or rollback statements it no
longer recognizes the transaction. What am I doing wrong?

on error goto errhandler
CurrentProject.Connection.BeginTrans
CurrentProject.Connection.Execute "update checklist_item set comment =
'transaction test' where checklist_item_id = 5127"
' CurrentProject.Connection.CommitTrans
CurrentProject.Connection.RollbackTrans

errhandler:
MsgBox Error(err.number)

the message I get is always the same.
"You have tried to commit or rollback a transaction without first
beginning a transaction"


What happens if you cache the object reference to the Connection?

on error goto errhandler

With CurrentProject.Connection
.BeginTrans
.Execute "update checklist_item set comment =
'transaction test' where checklist_item_id = 5127"
' .CommitTrans
.RollbackTrans
End With

errhandler:
MsgBox Error(err.number)
--
'---------------
'John Mishefske
'---------------
May 5 '06 #2
On 4 May 2006 11:03:32 -0700, "campbell_canuck"
<ch*******@hotmail.com> wrote:

What is the point of a transaction around a single update statement?
-Tom.
Hello and TIA,

I am trying to write some VB code to move some data between 2 Access
databases using a code module in Access. As part of it, I am trying to
use transactions.

However, by the time I get to the commit or rollback statements it no
longer recognizes the transaction. What am I doing wrong?

on error goto errhandler
CurrentProject.Connection.BeginTrans
CurrentProject.Connection.Execute "update checklist_item set comment =
'transaction test' where checklist_item_id = 5127"
' CurrentProject.Connection.CommitTrans
CurrentProject.Connection.RollbackTrans

errhandler:
MsgBox Error(err.number)

the message I get is always the same.
"You have tried to commit or rollback a transaction without first
beginning a transaction"


May 6 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Alban Hertroys | last post by:
Oh no! It's me and transactions again :) I'm not really sure whether this is a limitation of psycopg or postgresql. When I use multiple cursors in a transaction, the records inserted at the...
6
by: Christopher J. Bottaro | last post by:
Hi, Why is there no support for explicit transactions in the DB API? I mean like transaction() to start the trans and commit() and rollback() would end the trans or something. The reason why I...
7
by: Richard Maher | last post by:
Hi, I am seeking the help of volunteers to test some software that I've developed which facilitates distributed two-phase commit transactions, encompassing any resource manager (e.g. SQL/Server...
2
by: Ben Reese | last post by:
I have a DataTable that I am updating inside a transaction After each row is updated the changes on the row are implicitly accepted by the dataAdapter and the rowstate is set to unchanged....
9
by: TD | last post by:
I am trying to add transactions to my code. The original code worked fine until I followed an example to setup transactions, now the code does strange things, but no error messages. Could...
11
by: Mike P | last post by:
I've been using C# transactions for a while and had no problems with them. Using try catch blocks I can trap basically all possible errors and rollback all necessary data. Over the last few...
3
by: mehal.ua | last post by:
Hi, I'm tyring to use .net transaction, I have code like this : SqlConnection connection = Company.Instance.NewConnection(); using (connection) { SqlTransaction transaction =...
9
by: John Sidney-Woollett | last post by:
Is it possible to use the dblink and dblink_exec features from inside pl/pgsql functions to mimic the behaviour of nested transactions by calling another function or executing some SQL via the...
2
by: RAM | last post by:
Hello, (Sorry for my English...) I am learning .NET 2.0 (C#, ASP.NET, ADO.NET etc.). I need to write a database application (SQL Server) consisting of a number of database transactions (like...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.