Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

force save issue

Posted on 2013-10-30
7
Medium Priority
?
244 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
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 
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 31

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

618 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