Prevent Navigation on Dirty Record

JaedenRuiner

Registered User.
Local time
Today, 08:40
Joined
Jun 22, 2005
Messages
154
Okay,

Far be it for me to comment on the "intelligence" of this in Access, but if you create a form that references a table, it loads that current record. You then are allowed to modify that record through the form and proceed as normal.

Access, when you drop a command button onto that form in design view offers the ability to make that button into a "Save Record" button for you. Why the point? The moment you navigate to the next record, it saves the record for you anyway. I do not like this.

I want the ability that the moment the record is modified (becomes dirty or whatever semantics you prefer using), I want ALL NAVIGATION ability to cease. This includes the Mouse Wheel! At which point I will enable a save or cancel button to save or cancel the current records changes. Once the current record is no longer Dirty I want to reactivate navigation.

The fact that this is NOT the default behavior is probably why I always recommend against using Access to do databases, because with on slip, you can roll that mouse wheel and the navigation moves to the next record and BAM! all those alterations were not committed.

All the "best Practices" articles mention using transactions, but how do you link transactions into the form data binds? *sigh* i so prefer using SQL Server with a .Net front end, but this project requires me to use access so I'm trying to manhandle it into submission. (never an easy task).

Thanks
Jaeden "Sifo Dyas" al'Reac Ruiner
 
Its a shame your not a fan of Access but one thing you could do is create a form with unbound text fields and then only save the record to the table when you hit a save comand button.
 
Access 2007 has three On Mouse events.

I feel your pain, which is why I created my own technique many years ago with my A Better Mouse Trap? sample.
 
You can get away from saving the record from anything but your button simply by using a boolean value in the form's Before Update event. You set the boolean to true in the code for your button and in the before update event you check to see if it is true and if not you issue a Cancel = True and then it will not let anything update until you click the save button.
 
I also found this behavior disturbing because of some auditing requirements, so I took the same approach as SOS did. I have a flag that is set by clicking the COMMITME button on my form. If that flag isn't set and I'm about to do an update, I cancel event and before I release the event, I kvetch loudly through a message box.
 

Users who are viewing this thread

Back
Top Bottom