Prevent unwanted changes to records from being saved.

Zorkmid

Registered User.
Local time
Today, 07:42
Joined
Mar 3, 2009
Messages
188
I have asked this question in other ways and havent yet gotten an answer.

I have a search form that allows users to search for and edit records in the database. The main form has 3 command buttons

1. Search - Searches based on what user specifies
2. Clear - Clears search fields
3. Quit - Back to main page

My subform, where the records show up in form view when searched, has 2 buttons

1. Save changes
2. Undo changes

These regulate the editing of records.


The problem I have is that if the record is edited in the subform, and the user then hits the quit button in the main form, or closes down access, the changes are saved without the user having to confirm them.

Does anyone know of a solution by which I can prevent this?

P.S. Another problem is that if a user edits one record returned from the search (there could be several, navigated with nav controls) and then moves to another record, edits that, and hits undo changes, the changes are not undone from the first record.

-Z

Thanks alot.
 
Your confirm/reject changes code needs to be moved to the your buttons to the Form_BeforeUpdate event of the form the subform is based on. Anytime a change has been made to a record and the user tries to move to another record or back to the main form, this event will fire and you can elect to accept or undo the changes.
 
Hmmm, my forms are both unbound, so I dont think the update event even fires until I hit a button.

-Z
 
why would you not want to save a record you have edited?

why do you need to be asked?

its a different paradigm to excel, is all, so there's no undo button after a save

if someone doesnt want to change a record, then dont edit it

------
HAVING SAID THAT

iin the mainform, there will be an onexit event for the subform object

i think you can test there for "dirty" and cancel the exit, until the user either saves the record, or cancels ther edit.
 

Users who are viewing this thread

Back
Top Bottom