Solved

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

Posted on 2012-03-31
6
1,337 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
U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

 
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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

776 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