The first thing I do when creating an Access form is get rid of all the crap ways that Access tries to sneaky auto save and nobody would expect
@Isaac,
I know I've mentioned this before but, the ONLY place code is necessary is the form's BeforeUpdate event. You can write dozens of lines of code in multiple events but the reality is code is only actually required in the BeforeUpdate event. If the code is not there, you run the risk of a bad or incomplete record from being saved. I once removed 5,000+ lines of code from an application. This person had clearly discovered that his messages were being ignored and bad data was being saved. He had code in 5 control level events for every control on every form. And it still didn't work so he expanded it so that cntl1 checked cntl1, cntl2 checked cntl2 AND cntl1, cntl3 checked cntl3 and cntl2 and cntl1. So you can see how the code accumulates. There was also code in several form level events. The bottom line here is the was NO code in any of the BeforeUpdate events so no matter how much code he wrote he wasn't able to stop the save of bad data.
If you want to use a Save button and ensure that people use it, the process is very simple:
1. Define a public variable. Call it SavePressed or something.
2. In the Current event - SavePressed = False
3. In the cmdSave button's Click event - SavePressed = True
4. In the form's BeforeUpdate event - If SavePressed = True ....
5. In the unload event - add code to cancel if form is dirty. You may need code some other place to trap 2501 if you have a close button.
This allows you to force the user to press your save button.
@tmyers,
You have NO validation code in the BeforeUpdate event. How do you know the changes are valid? That is the code that belongs in the BeforeUpdate event. And you can use the procedure above to force the user to use a Save button if that floats your boat.
You don't have to ask people if they want to save if you validate their entries so you can prevent partial updates or outright errors from being saved. As someone already mentioned, asking gratuitous questions just trains users to click without reading. Instead be parsimonious with your messaging. You want the user to read messages because they are important.