Solved

Transactions with .Recordset Clone?

Posted on 2000-03-29
4
360 Views
Last Modified: 2006-11-17
I can’t get Transactions to work with a recordset created with the Form.RecordsetClone (i.e. updates are made but the .Rollback method does not.  Is it possible to use Transactions on recordsets created with the .RecordsetClone, or is something wrong with my code?
(sample code follows)

Sub ModuleName()
Dim ws As Workspace  
Dim rs As Recordset
Set ws = DBEngine.Workspaces(0)
Set rs = Forms!FormName.RecordsetClone
ws.BeginTrans
While Not rs.EOF
    rs.Edit
    rs!FieldName=SomeValue
    rs.Update
    rs.MoveNext
Wend
If SomeTest = True Then
    ws.CommitTrans
  Else
    ws.Rollback
End if
End Sub
0
Comment
Question by:GJeppson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:GJeppson
ID: 2669688
Adjusted points from 100 to 200
0
 
LVL 54

Expert Comment

by:nico5038
ID: 2670336
I'm using Access 2000 and in the helpfile they give a sample for Commit/Rollback, but only for a connection object.

In the sample they create a new adodb.recordset to perform the updates on and conditionally commit or rollback.

Do you have Access 2000 ?
Then check upon the connection object's methods (commit/rollback) for the sample.
0
 
LVL 14

Accepted Solution

by:
mgrattan earned 200 total points
ID: 2725445
Does the form have a subform?  If so, then this behavior is by design and you will need to use more explicit declarations for your recordsets.  See article at http://support.microsoft.com/support/kb/articles/Q131/5/35.asp?LN=EN-US&SD=gn&FR=0
0
 
LVL 54

Expert Comment

by:nico5038
ID: 2727186
Just re-read the question. And are wondering why you are performing a commit/rollback on a RecordsetClone.
It is a copy of a recordset and when you are finished and doesn't want the updates you just "drop-it" and take a new set by specifying set rs = ..recordsetclone again.
When you are concerned that somebody has changed something in the meantime you could use two clone sets: set rs1 to recordsetclone and rs2 = rs1. The instead of a rollback you use rs1 = rs2?!

Basically a commit and rollback is used to secure multiple updates on "real" table(s) and to correct the updates when not every individual update was successfull.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question