is there a way to save and Don't save bounded fields?

rehanemis

Registered User.
Local time
Today, 19:01
Joined
Apr 7, 2014
Messages
195
Hi,
I am playing with ms access forms. So I created a form using Form Wizard and my form fields are bounded. So I have two buttons 1- Save 2- Cancel.
I want to save the record to table is Save button is presses and don't save the record (either user entered data into the fields) if Cancel button is pressed.

any suggestion?
 
use Transactions to save/cancel your updates.
or you can use the Form's BeforeUpdate event to save/ cancel your updates.
 
Last edited:
this is a demo.
open "1000 Sales Records" form.
1. delete some "text", go to another record and delete more text.
press Cancel button.
2. delete some Records.
press cancel button.
 

Attachments

If you have a "Don't Save" case and you wish to merely discard everything without saving anything, make your Don't Save button using the form's Button Wizard. One of the operations will UNDO the changes. That is the simplest way when ALL of the fields are bound. The Save button is also available from the form's Button Wizard. In this context, for a fully bound form,

The Save operation makes the underlying record's fields match the controls to which they were bound. I.e. the current record is made to match the form. Since this counts as making the record 'current' you will get a Form_Current event when the save is complete.

The Undo operation makes the underlying record's fields reload the controls to which they were bound, overwriting the changes in the controls. OK, for the purists, technically this makes all bound control .Value properties match the same control's .OldValue properties, which were loaded during the previous Form_Current event. That is, the form is made to match the current record. Since this is an Undo action, it triggers the Form_Undo event when complete.

You said this was a case of all controls being bound. IF you had any unbound controls, they don't have .OldValue properties so they don't get reset by a Form_Undo operation.
 
Thanks for all replies. I will play with techniques after few hours.
 
If I close the form, the change is silently discarded but the user thinks the change has been saved.
I want to save the record to table is Save button is presses
the default action, as per request is not to save.

are you my "dark" shadow? everywhere i post, you Contradict it!
 
Last edited:
this is a demo.
open "1000 Sales Records" form.
1. delete some "text", go to another record and delete more text.
press Cancel button.
2. delete some Records.
press cancel button.
@arnelgp
Thanks for the sample file. I'd always wondered how a transaction works behind a bound form.
Do you happen to have a sample file without using a class?
Thanks.
 
. I'd always wondered how a transaction works behind a bound form.
Transaction works by Caching all the Updates (insert, update, delete) of all records of the
form in memory. meaning it does not physically saved the record in the disk yet until you
tell it to (commit).

without using Class.
 

Attachments

Thanks for all replies. I will play with techniques after few hours.
The standard behaviour of access is to try to save changes automatically. Personally, I think trying to prevent that standard behaviour is very difficult to do. Experienced users won't expect to explicitly click "save". It's rather like removing the standard buttons at the top tight of a form. Something to be used sparingly if at all.

Perhaps @arnelgp can confirm, but I imagine the liberal use of transactions may cause complications in a multi user environment. If your change isn't committed, what happens to subsequent users who need your data. Do they have to wait for your transaction to complete?
 
The standard behaviour of access is to try to save changes automatically. Personally, I think trying to prevent that standard behaviour is very difficult to do. Experienced users won't expect to explicitly click "save".
Yeah, a "Save Button" in access is like going outside in the middle of winter and wanting an extra feature to help you get cold. In Access the mindset needs to change from "save / cancel" to "confirm / cancel".
 
Just for the record, in my biggest project for the Navy, the ideas of a SAVE and a CANCEL button were necessary due to the Access behavior of automatically saving on navigation. Because this was a security-related record-keeping database, we had to include certain affirmations that would have been lost by allowing automatic saves on a navigation. Admittedly an extreme requirement but what do you do when the IT department AND the boss both want it? AND can cite regulations for it.
 
Because this was a security-related record-keeping database,
Using Access????
 
@MajP I think it depends on the situation.
Just curious to know how you save a record on a single form and on edit mode? You move next and then move previous or you use a Save button?
 
I think it depends on the situation.
No, it does not. It just saves.
Or to say it another way. I probably have built easily over 1k Access databases and never added a save button. It is a "football bat".
 
Just curious to know how you save a record on a single form and on edit mode
Ehhh, do just about anything like close the form, move to the next record, I don't know.
 
No, it does not. It just saves.
Or to say it another way. I probably have built easily over 1k Access databases and never added a save button. It is a "football bat".
IIRC, the only time I ever had to add Save buttons was on the insistence of a client who wanted to push the buttons. ... On the forms, not their developer. ;)
 
Using Access????

Yes. We were tracking the status and results regarding required maintenance that had to be done on the 1500+ servers and 80+ projects we were hosting. Essentially, tracking whether server XYZ on project ABC was patched according to the latest (twice-monthly) directives. The DB was deemed to be Sensitive But Unclassified and was hidden behind a couple of pretty stout Navy firewalls. It was not accessible to the world and the reports it gave us were important to the 80+ project managers. It did not contain personally identifiable information and didn't contain server passwords, so we got by using Access. There's a longer story than that, but I believe that answers the basic question.
 
IIRC, the only time I ever had to add Save buttons was on the insistence of a client who wanted to push the buttons. ... On the forms, not their developer. ;)
going back to post#1, that was the one being asked (for suggestion).
I want to save the record to table is Save button is presses and don't save the record (either user entered data into the fields) if Cancel button is pressed.

any suggestion?
 

Users who are viewing this thread

Back
Top Bottom