Transaction Rollback/Commit ?

M

midnite oil

Hi,

Can anyone point to me where I can read up on and implement a form with
transaction rollback and commit for Access 2000.

I am in a situation where I have to fix someone's else design/code. There
is a Main form and a Subform (all forms controls bound to 2 tables) and Dirk
G. has in the past showed me how this Parent/Child form works - in that once
focus leaves main form, the record gets saved ! So, I spent a bit of time
working around to 'UNDO' an entry if user decides not to proceed with
entrying a new record so I am good for the NEW entry.

But for EDIT an existing record, here is my problem...

There is also a SAVE button on the form which all it does is to close the
form. There is a also a RETURN TO MAIN button which will close the form and
display the main menu form. So, the SAVE button is really quite redundant
since data entered is saved automatically as soon as form is closed. Either
button being clicked, the data will be saved no matter what. The QA people
is saying this SAVE button is misleading (I agree 100%). I think buttons
like 'Save and Exit' and 'Undo and Exit' are clearer to the users.

I now have to find a solution which won't costs me too much time that allows
the user to UNDO changes made, don't save the data if they wish not to and
exit the form. There are 2 other forms that have Parent/Child forms that
behaves similar and also a bunch others that have this SAVE button that does
nothing but close the form.

I found some information on Transaction and it won't work with Set
db=currentdb() - that's how the application opens the db everywhere in the
form.

I can think of taking snapshot of the data on form_load and if the user UNDO
changes, then I use this data to replace the values in the form and for the
Subform (depending on whether they have added or removed detail records) I
will remove all records and recreate with my snapshot data.

Would appreciate any feedback on how best I can implement an UNDO when
editing a record. Thank you in advance for helping.

Thanx
 
A

Allen Browne

This is not going to happen in Access.

You cannot open a main form within a custom transaction, and have the
subform loading records inside the same transaction so you can roll the
whole thing back.

Further, Access is multi-user software, and you are not going to be able to
allow multiple users to edit simultaneously and then selectively undo a
user's changes while maintaining other users' edits.
 
M

midnite oil

Hi Allen,

Thank you for the feedback.

Is there a work around the form/subform so coding an UNDO function is
possible ?

Looking for alternatives......
 
M

midnite oil

Hi Allen,

Sorry to be a pain ...just have to make this one last confirmation before I
go inform my boss and the customer the sad truth.

Tracking Form has Main form (all controls bound to table A) and Subform -
multi records (control bound to table B). User selects a record to EDIT
from a search results form. THe Tracking Form is opened for editing for the
particular record.

I CANNOT do this (to provide an UNDO functionality) :

1) OnLoad event, put all fields current values (Master/Subform) in some
holding variables.
2) User makes changes to current values in Master/Subform.
3) User clicks on Undo Changes
4) I re-create the original values (values before any changes took place)
by :
a) overwriting Master form fields values from those values in holding
variables
b) delete all Subform records and add the record(s) from those found
in holding variables
5) When user exits the form, Access will be saving technically the original
values.

I do appreciate your help in this. I'd be so glad once this application is
completed and accepted.

Thank you.
 
A

Allen Browne

You cannot do that with bound forms.

If you want to do it with unbound forms, temp tables, and variables, and try
to manage the concurrency issues that you are creating between potential
users and processes, you'll need a big budget and lots of time, and I doubt
Access is the correct development platform for this project.
 
M

midnite oil

Hi Allen,

Thank you very much and appreciate your patience with having to come back to
this newsgroup item.

I continued with the project after the lead developer/pm for this project
went on to another opportunity.

"I doubt Access is the correct development platform for this project. " -
my previous boss (resigned) asked why Access, my current project manager
asked the same question. Don't have the answer. Have never been involved
in sitting down with the customer to discuss design and requirements. After
I took over the project, it was already almost in the middle of the project
and discussions with customers were clarifications on functionalites more
than anything else.

Once again, thank you, thank you for helping...

ym
 
C

Carol Giannini

Can't you use the OldValue property to hold the value before edits, then
return to that value if you decide to discard the edits? Look up OldValue
Property under Help; it might answer your questions.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top