Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Workspace transactions - Access 2000

Posted on 2003-10-25
1
Medium Priority
?
296 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 440 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

636 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