Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

force save issue

Posted on 2013-10-30
7
238 Views
Last Modified: 2013-10-30
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
Comment
Question by:terpsichore
7 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 39612453
<<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
 

Author Closing Comment

by:terpsichore
ID: 39612465
ok! simple enough - many thanks.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 39612467
...and just to be clear, ...
Is the before update event of the *form*, ...or for a control?
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
LVL 75
ID: 39612468
"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
 
LVL 75
ID: 39612478
You are likely masking a problem if you do not troubleshoot why the BU event is not triggering ...
0
 
LVL 57
ID: 39612527
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
 
LVL 30

Expert Comment

by:hnasr
ID: 39612555
Unable to reproduce the issue.
BeforeUpdate is triggered.

Try it by changing any field value in BeforeUpdate event procedure.
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question