Dumferling
Member
- Local time
- Today, 10:59
- Joined
- Apr 28, 2020
- Messages
- 102
Most of my forms have a save button on them. What I find is that when the user click on the save button and the code executes, Access jumps to the BeforeUpdate event which, as a default, has similar code in it. It jumps when it hits the line in the Save button code which commits the changes to the underlying table. My objective is to ensure that changes are deliberately saved (access will save things when you move off the record but I need my users to make a deliberate choice about the save). So I want the BeforeUpdate event to trigger if there is unsaved data and the user moves to another record but I also want to be able to jump the code in the BeforeUpdate event if the BeforeUpdate event is being triggered by the user clicking the save button. To put it simply:
User clicks Save button - BeforeUpdate event code is bypassed and Save button procedure saves record
User moves to another record without clicking Save button - BeforeUpdate event code runs to check if they want to save the changes
The only way I can think of doing this is by somehow passing a value from the Save procedure to the BeforeUpdate event procedure. Is there a simpler way to do this? And, if not, how can get the BeforeUpdate event to recognise that it is being triggered by someone clicking the save button?
Right now I am feeling that I am being dense and there is simple way to handle this.
User clicks Save button - BeforeUpdate event code is bypassed and Save button procedure saves record
User moves to another record without clicking Save button - BeforeUpdate event code runs to check if they want to save the changes
The only way I can think of doing this is by somehow passing a value from the Save procedure to the BeforeUpdate event procedure. Is there a simpler way to do this? And, if not, how can get the BeforeUpdate event to recognise that it is being triggered by someone clicking the save button?
Right now I am feeling that I am being dense and there is simple way to handle this.