Prevent auto save on form (1 Viewer)

Isaac

Lifelong Learner
Local time
Today, 03:47
Joined
Mar 14, 2017
Messages
8,774
You can spend your days arguing with Access or you can work with it.
I'm sorry, but I think it is MUCH easier to spend 3 minutes doing what it takes to disallow all the auto saves and then provide a button. That is about what it takes me. :)

My rule is I always strive to create an interface that either meets user's expectations or creates them for them. When your interface defies expectations, that causes irritable users. I don't really care what Microsoft thinks it should be, I care about my users.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:47
Joined
Feb 19, 2002
Messages
43,213
But you could spend that 3 minutes in the form's BeforeUpdate event and have the same effect???

If you do it your way, you have to make absolutely sure to block ALL paths that leave to a save. How much code does that take? Exactly what events do you put code in? Are you sure you've gotten them all? Remember that app I told you about where i removed over 5,000 lines of code because the code was in every event except the form's BeforeUpdate event and that person just couldn't figure out how to stop the save. The solution was moving one set of the code to the BeforeUpdate event and cancelling the save when a validation error was found.
 
Last edited:

Minty

AWF VIP
Local time
Today, 11:47
Joined
Jul 26, 2013
Messages
10,366
I'm sorry, but I think it is MUCH easier to spend 3 minutes doing what it takes to disallow all the auto saves and then provide a button. That is about what it takes me. :)

My rule is I always strive to create an interface that either meets user's expectations or creates them for them. When your interface defies expectations, that causes irritable users. I don't really care what Microsoft thinks it should be, I care about my users.
How do you block right-clicking and select form close in the form header, unless you have completely disabled right-clicking or shortcut menus?
Or Alt-f4

I can't believe all of these are blocked in 3 minutes of code.
(Just being argumentative hear by the way) ;)
 

Isaac

Lifelong Learner
Local time
Today, 03:47
Joined
Mar 14, 2017
Messages
8,774
How do you block right-clicking and select form close in the form header, unless you have completely disabled right-clicking or shortcut menus?
Or Alt-f4

I can't believe all of these are blocked in 3 minutes of code.
(Just being argumentative hear by the way) ;)
Oh - I don't block any of those things.

2 lines of code as posted earlier.

1) global blAllowSave as boolean
2) [in the form's BeforeUpdate event]--if blAllowSave=False then Cancel=true

(and of course my Save button sets blAllowSave to True)

...done deal. Now you can nurture this incredibly simple and intuitive expectation to the user: "Nothing ever gets saved unless you press the button"........which is pretty much what they came into the picture expecting, anyway, given the presence of a button labeled "save".

I'd say that's probably more like 60 seconds or less of coding. And now you can skip all of those ugly scenarios like:
- the user dirties the record, then wants to close the form, assuming it won't save
- then you have to catch that error "you can't close this object", undo the dirty, probably add in some confirmation to figure out what the user actually does want to do, etc. etc. All of that junk is just gone, they're not even scenarios any more.
- the user inadvertently dirties a record then wants to change a tab page

Of course there are a thousands ways to get around all of these scenarios. I just cancel them all out by Cancel=True if my special button boolean flag isn't True. :)
 

Isaac

Lifelong Learner
Local time
Today, 03:47
Joined
Mar 14, 2017
Messages
8,774
But you could spend that 3 minutes in the form's BeforeUpdate event and have the same effect???
No, now if a user dirties a form and closes it, you'll need to figure out their intentions, in order to be responsible. Did you mean to dirty this? Do you want to save? If not, you'll need to undo before you close the form - etc. etc.

If my boolean isn't True, then Cancel=True. No questions, no errors to catch, nothing to undo, nothing.
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:47
Joined
Feb 19, 2002
Messages
43,213
You don't need to figure out his intentions. You only need to determine if the required data is present and the validation rules are satisfied. I don't believe I've ever run into a situation where there were no required fields and no validation rules. In that case, the validation would be to determine that all controls are null, then ask if the user really means to save an empty record or just refuse to do it since it makes no sense and give him a warning or just close silently.
 

Users who are viewing this thread

Top Bottom