Solved

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

Posted on 2012-03-31
6
1,286 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

746 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

11 Experts available now in Live!

Get 1:1 Help Now