Solved

Workspace transactions - Access 2000

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

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
query error in former passthrough query 2 31
Undo Button 1 32
MS Access, How to create variable 9 37
Getting "Invalid Operation" Error when opening a Recordset 10 33
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

735 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