Solved

Workspace transactions - Access 2000

Posted on 2003-10-25
1
285 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

708 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now