Isaac
Lifelong Learner
- Local time
- Today, 05:05
- Joined
- Mar 14, 2017
- Messages
- 8,777
What that does: If the record has unsaved changes (i.e., someone has changed a control's value, but the record isn't saved yet), then Save the Record.There are several "If Me.Dirty then Mr.Dirty = False" statements throughout the code
If you have people who coded that willy-nilly all over the Controls' Change, Enter, Exit, or AfterUpdate events, then no wonder it's confusing--your form is saving a record constantly, and far more than is needed.
Yes, Me.Dirty=False will 1) save the record, 2) trigger the beforeupdate event.
And by the way, if the db you inherited has all of that 'extra' code that it sounds like it does, where it is forcing the form to Save the entire record many more times than is necessary, then you'll end up with the same set of problems even if you use the form's AfterUpdate event...because if an end user edits one single control and then some code fires "Me.Dirty=False", that will trigger a Save...which will trigger BOTH the BeforeUpdate AND the AfterUpdate events, and you'll be left with a confusing situation, because the code will be forcing the entire record to save over and over while the poor user is just editing individual controls!
First order of business - make sure there is no code to explicitly force a save (me.dirty=false), anywhere except where it really should be, which might well be "nowhere", since the form will save the record any time someone goes to another record or closes the form..
Well, all I can say is I posted a working database as an example to help you out. It works. Check it out. Good luck with your project!To those asking, I was definitely working with the Form.BeforeUpdate events.
Last edited: