Solved

Access 2010: Forms Commit Data Changes When Record Is Changed - Yikes!

Posted on 2012-03-31
6
1,317 Views
Last Modified: 2012-03-31
Hello  - New to Access 2010, I am noticing Access 2010 seems to commit data changes in text boxes, on a bound form ONLY when a different record is displayed on the form - NOT when the focus moves to a different text box (After Update) on the form as in Access 2003!  - This behavior is problematic.

I understand it is possible to add the VBA command:
DoCmd.RunCommand acCmdSaveRecord
to the On Change event for all text boxes, but this seems very inefficient - particularly if there are lots of text boxes on the form (and many forms!).

So, how is it possible to have data changes in text boxes committed to the underlying table After Update for ANY text box on a form, without having to add a Do Command to each text box On Change event?

Many Thanks - Jacob
0
Comment
Question by:Chi Is Current
6 Comments
 
LVL 77

Assisted Solution

by:peter57r
peter57r earned 100 total points
ID: 37790232
It's not possible.  If you want to save changes on every data change you have to put to Save command into your code.

Why is it a problem for you? This is how the entire IT database world works, not just Access. And most other databases require a Save or Submit button to be clicked.
0
 
LVL 9

Expert Comment

by:OCDan
ID: 37790568
I agree with peter57r this is how the vast majority of systems work, thats why you have a save/apply button on many forms within programs.

Can I ask why it is that you need the changes to be saved after exit of each field?
0
 
LVL 20

Assisted Solution

by:clarkscott
clarkscott earned 100 total points
ID: 37790710
Actually, the way it works is best because you can CANCEL the entire change of the record, or a single text box by hitting esc (once for current field, twice to return the entire record back to original).     Also, you will eventually leave the record, and that's when the changes are saved.

Scott C
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 57

Assisted Solution

by:Jim Dettman (Microsoft MVP/ EE MVE)
Jim Dettman (Microsoft MVP/ EE MVE) earned 100 total points
ID: 37790828
Jacob,

  Not to pile on here, but I would ditto what the others have said; this is the norm.

 The only wrinkle Access has is with subforms.  When you move to a subform, it comitts the main form record.  That is a problem for most because if the user wants to cancel the edit, you'd want to do it as a unit (main and subs), but the main has already been saved and you simply can't undo.

  But outside of that, it works as expected.

  You also should be aware that most controls have:

 .Text - Current value before the user moves focus to another control
 .Value - Current value comitted to buffer
 .Oldvalue - Value of the control when the record was loaded.

  Maybe that will help with what your trying to accomplish.

Jim.
0
 
LVL 49

Accepted Solution

by:
Gustav Brock earned 200 total points
ID: 37790837
Oh, it certainly can be done - using class programming and WithEvents.
Here is how:

http://www.vb123.com/index.html?199812_mk_events.htm

Further about DEEP, Dynamic External Event Procedures, by Shamil Salakhetdinov, the first to describe this in full for practical use:

http://www.vb123.com/index.html?199901_ss_event.htm

That said, most working with this - including myself - have left Access and VBA and turned to Visual Studio and WinForms because if you drive the technique to some limits (well beyond the examples here), Access will crash so you end up wasting your time.

/gustav
0
 
LVL 2

Author Comment

by:Chi Is Current
ID: 37791758
OK.  Thank you all for your insight and questions here.  Yet another opportunity for re-envisioning the way I look at Access and adjusting accordingly.

With Best Regards, Jacob
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now