Go Back   Access World Forums > Microsoft Access Discussion > General

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 10-12-2018, 09:11 AM   #1
AvantGuy
neophyte
 
AvantGuy's Avatar
 
Join Date: Mar 2018
Location: Pueblo, Colorado USA
Posts: 22
Thanks: 13
Thanked 0 Times in 0 Posts
AvantGuy is on a distinguished road
In a Tab Control moving thru Recordset, dirty/undo questions

[I'm still an Access neophyte, so feel free to treat me as such :-)]

I'm seeking advice on how to architect my in-progress, bound form design containing a tabControl. Whichever page of the tabControl is active, the user will move through the Recordset and may make edits to some records and only view others. Via a single operation, they may wish to save all edits or undo all edits*. A bound form default behavior seems to be to save an update whenever an edited control loses focus. Because in my case dirty status must be determined at the Recordset level (controls-dirty is out of the question, seems to me, because the controls on a given tabPage are shared among all records), I'm finding several potential alternatives to handle Undo, such as:
  • ​​an in-code temp array to compare against the recordset for changes ​​​​
  • ​​​​use of clone recordse​​t​ for comparisons​ ​
  • a TRANSACTION​​
Have I discovered all the relevant alternatives?
Any suggestions as to the pitfalls and merits of each of these?
* Additionally, I may implement a per record save if such would not conflict with the batch save/undo; this is not yet in the spec and I consider it optional at this time.
Thanks, Bob

__________________
COME COME and cull me bonny bony doublebed cony swiftly my springal and my thin Kerry twingle-twangler comfort my days of roses days of beauty week of redness with mad shame to my lips of shame to my shamehill for the newest news the shemost of shenews is I'm lust-beleperd and unwell..." --Samuel Beckett
AvantGuy is offline   Reply With Quote
Old 10-12-2018, 09:30 AM   #2
Ranman256
Newly Registered User
 
Join Date: Apr 2015
Location: KY,USA
Posts: 3,139
Thanks: 0
Thanked 683 Times in 668 Posts
Ranman256 will become famous soon enough Ranman256 will become famous soon enough
Re: In a Tab Control moving thru Recordset, dirty/undo questions

a bound recSet updates immediatly. No undo.
Why would someone update several records then want to undo them all.
It kinda says they dont know what theyre doing.

you could use a form not connected to the main tables,
user select a record, it is copied to a 'history' table (the old rec)
then user edits a local copy, and 'saves' it, and a query updates the main table.

The 'undo' would use the history tbl to put them back.
Ranman256 is offline   Reply With Quote
The Following User Says Thank You to Ranman256 For This Useful Post:
AvantGuy (10-13-2018)
Old 10-12-2018, 10:03 AM   #3
June7
Newly Registered User
 
Join Date: Mar 2014
Posts: 815
Thanks: 0
Thanked 185 Times in 185 Posts
June7 will become famous soon enough
Re: In a Tab Control moving thru Recordset, dirty/undo questions

Data entry/edit is committed to table when:
1. close table/query/form
2. move to another record
3. run code to save

Transaction method might be able to facilitate what you want to do - undo all edits in a work session. I have only ever used Transaction once. For a start review https://support.office.com/en-us/art...F-DA16B3111439. However, I don't understand the remark about not supported for linked tables because it is in a split db I use Transaction.

__________________
To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.

Last edited by June7; 10-13-2018 at 10:53 AM.
June7 is offline   Reply With Quote
The Following User Says Thank You to June7 For This Useful Post:
AvantGuy (10-13-2018)
Old 10-13-2018, 07:58 AM   #4
AvantGuy
neophyte
 
AvantGuy's Avatar
 
Join Date: Mar 2018
Location: Pueblo, Colorado USA
Posts: 22
Thanks: 13
Thanked 0 Times in 0 Posts
AvantGuy is on a distinguished road
Re: In a Tab Control moving thru Recordset, dirty/undo questions

Quote:
Originally Posted by Ranman256 View Post
...It kinda says they dont know what theyre doing.
It's more likely 'tis I the one who knows not what he's doing.

Quote:
you could use a form not connected to the main tables,
user select a record, it is copied to a 'history' table (the old rec)
then user edits a local copy, and 'saves' it, and a query updates the main table.

The 'undo' would use the history tbl to put them back.
Yet another way to get to that double buffering idea...(?)

My understanding of the convention for undo is a second recordset, rather than a second table. I've gone for 3NF and my queries involve joins of many tables. This led me to look at the clone recordset idea or the VBA array (which I've think means I need to change to unbound form). If I stay with a bound form it seems use of TRANSACTION would be indicated.
__________________
COME COME and cull me bonny bony doublebed cony swiftly my springal and my thin Kerry twingle-twangler comfort my days of roses days of beauty week of redness with mad shame to my lips of shame to my shamehill for the newest news the shemost of shenews is I'm lust-beleperd and unwell..." --Samuel Beckett
AvantGuy is offline   Reply With Quote
Old 10-13-2018, 07:59 AM   #5
AvantGuy
neophyte
 
AvantGuy's Avatar
 
Join Date: Mar 2018
Location: Pueblo, Colorado USA
Posts: 22
Thanks: 13
Thanked 0 Times in 0 Posts
AvantGuy is on a distinguished road
Re: In a Tab Control moving thru Recordset, dirty/undo questions

Quote:
Originally Posted by June7 View Post
...Transaction method might be able to facilitate what you want to do - undo all edits in a work session....
I'm beginning to think that the TRANSACTION is the most idiomatic way of getting the Undo, assuming bound forms where all the controls are paged, as in my case with the Tab Control.

My research revealed the clone recordset method and the in-code array alternatives, but I believe this must be for unbound forms. Lots of own-code effort for that, it seems.
__________________
COME COME and cull me bonny bony doublebed cony swiftly my springal and my thin Kerry twingle-twangler comfort my days of roses days of beauty week of redness with mad shame to my lips of shame to my shamehill for the newest news the shemost of shenews is I'm lust-beleperd and unwell..." --Samuel Beckett
AvantGuy is offline   Reply With Quote
Old 10-13-2018, 08:27 AM   #6
MajP
Newly Registered User
 
Join Date: May 2018
Posts: 605
Thanks: 8
Thanked 138 Times in 136 Posts
MajP will become famous soon enough
Re: In a Tab Control moving thru Recordset, dirty/undo questions

A clone recordset will absolutely not work. It still touches the same tables. It is not static. You change in the clone it will change in the table. You can do this with transactions, but that is not really the purpose of a transaction. If this is a multiuser database you will lock a large portion of the database for other users while a person has this long running transaction open. I do not understand why you would edit multiple records and then choose to undo them all, but if that makes sense then OK. I would think the only two options are a temp table or a disconnected ado recordset.
MajP is offline   Reply With Quote
Old 10-13-2018, 08:34 AM   #7
MajP
Newly Registered User
 
Join Date: May 2018
Posts: 605
Thanks: 8
Thanked 138 Times in 136 Posts
MajP will become famous soon enough
Re: In a Tab Control moving thru Recordset, dirty/undo questions

Also when you have a transaction open the user will have very limited options what can be done on those records. No ability to filter, sort etc. Transactions are meant when you need to ensure multiple things happen if not none happen. You need to withdraw money from table A and pay for something in table b. If A fails then B cannot happen. Here is a good article
https://codekabinett.com/rdumps.php?...ss-transaction

MajP is offline   Reply With Quote
Old 10-13-2018, 01:30 PM   #8
AvantGuy
neophyte
 
AvantGuy's Avatar
 
Join Date: Mar 2018
Location: Pueblo, Colorado USA
Posts: 22
Thanks: 13
Thanked 0 Times in 0 Posts
AvantGuy is on a distinguished road
Re: In a Tab Control moving thru Recordset, dirty/undo questions

Quote:
Originally Posted by MajP View Post
A clone recordset will absolutely not work. It still touches the same tables. It is not static. You change in the clone it will change in the table.
...an insight I missed during my readings.

Quote:
You can do this with transactions, but that is not really the purpose of a transaction. If this is a multiuser database you will lock a large portion of the database for other users...
This app will not require concurrency. But my habit is to avoid methods that obviate future features, so I shall take heed re Transaction.

Quote:
...I would think the only two options are a temp table or a disconnected ado recordset.
Temp table, then, also as Ranman256 also alluded to.

I shall ponder my options, including limiting dirty to single records, forcing user to save or undo before stepping off current; lots of smoke by me but no fire. Thanks MajP, et al.

__________________
COME COME and cull me bonny bony doublebed cony swiftly my springal and my thin Kerry twingle-twangler comfort my days of roses days of beauty week of redness with mad shame to my lips of shame to my shamehill for the newest news the shemost of shenews is I'm lust-beleperd and unwell..." --Samuel Beckett
AvantGuy is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Form Control still 'saving' after Undo/Cancel David R Forms 3 07-09-2014 08:28 AM
[SOLVED] Pencil/Triangle Dirty/Undo caferacer Forms 2 05-19-2014 01:46 PM
Unable to undo changes when control lost focus JenSGT Forms 1 08-05-2009 06:42 AM
Need to Save a Dirty Record without moving to another Record ions Forms 2 04-01-2009 09:09 AM
[SOLVED] Moving to subform when ME Dirty bmunk Forms 4 09-29-2003 03:23 PM




All times are GMT -8. The time now is 08:05 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Sponsored Links

How to advertise

Media Kit


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World