• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 248
  • Last Modified:

force save issue

Dear experts -
Hopefully very simply question - I have a save button, but have code in the before update I want to run when someone hits the SAVE button - regardless of whether the form is dirty or not.
I put "me.dirty = false" in the button's code, but this doesn't seem to trigger the beforeupdate code.
Any ideas?
Or do I simply have to put the beforeupdate code into a procedure and call that?
Thanks!
0
terpsichore
Asked:
terpsichore
1 Solution
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
<<Or do I simply have to put the beforeupdate code into a procedure and call that?>>

 That's what I'd do.  Put it in a procedure, then call from both places.

 Jim.
0
 
terpsichoreAuthor Commented:
ok! simple enough - many thanks.
0
 
Jeffrey CoachmanMIS LiasonCommented:
...and just to be clear, ...
Is the before update event of the *form*, ...or for a control?
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
"but this doesn't seem to trigger the beforeupdate code."
Then something is wrong ... and you should resolve the issue.
Me.Dirty = False *should* trigger the BU event,

Are you **sure** the Form is actually Dirty ?
IF - this happens to be an unbound form (?), Dirty does not apply. Or if you are changing values in an unbound control - and expecting the Form Dirty property to be set - does not happen in unbound controls.

mx
0
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database ArchitectCommented:
You are likely masking a problem if you do not troubleshoot why the BU event is not triggering ...
0
 
Jim Dettman (Microsoft MVP/ EE MVE)President / OwnerCommented:
Your other option is to always force the form .dirty in the oncurrent event.   That's problemactic though because OnCurrent gets fired a number of times possibly.

With calling the code though, watch out for other ways to move off the record, like the page up/down key, which by default, let's you move previous/next through records.

Jim.
0
 
hnasrCommented:
Unable to reproduce the issue.
BeforeUpdate is triggered.

Try it by changing any field value in BeforeUpdate event procedure.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now