?
Solved

force save issue

Posted on 2013-10-30
7
Medium Priority
?
242 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
[X]
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
7 Comments
 
LVL 58

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 2000 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
Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

 
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 58
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

777 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