Solved

Workspace transactions - Access 2000

Posted on 2003-10-25
1
288 Views
Last Modified: 2007-12-19
I have read heaps of webpages and help pages on how to declare a workspace, start a transaction using BeginTrans and cancelling it using Rollback. I can't get it to work.

I am using it as part of a form (containing a subform)

Dim wksp As Workspace

Private Sub cmd_Cancel_Click()
    wksp.Rollback
    DoCmd.Close acForm, "frm_DebtorInv"
End Sub


Private Sub Form_Open(Cancel As Integer)
    Set wksp = DBEngine.Workspaces(0)
    wksp.BeginTrans
End Sub

I've also tried
   DBEngine.Workspaces(0).BeginTrans
instead of using the wksp object variable.

I get no errors, but I can't get it to rollback the values
 - The values of 3 bound controls in the form
    and of many records in a subform (items on an invoice)

Thanks all
Brad
0
Comment
Question by:brad103
1 Comment
 
LVL 54

Accepted Solution

by:
nico5038 earned 110 total points
ID: 9622312
Hi Brad,

I'm afraid you'll have to change your approach.
As far as I know the COMMIT/ROLLBACK will only work on transactions executed in a "batch".
The form however will "break" the sequence.

I would probably switch to using temp table(s). In the FormOpen event I create the tables and when the [Save] is given I delete the original rows and insert the temp table row(s) into the original table. When the form is Cancelled I have nothing to do......

Nic;o)
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

808 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