×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

before update & subforms

before update & subforms

before update & subforms

(OP)
I have written a sub to run on the before update event of a form in order to produce a history table of changes made to the data. This works perfectly in theory, but it falls down badly when a subform is introduced. As soon as the focus switches to the subform, it will register the changes & create a history entry. In the case of my db, it then switches to another subform & then back to the main table. By the time you have actually edited the record & moved onto the next record, it has saved at least 2 entries into the history table. Therefore, is there any way to surpress this function so that it only runs upon record-change. I am thinking that attaching the code to the 'on lost focus' event of the last control on the form, but i get the feeling it will then save a copy of the updated data, not the existing......


Any suggestions????

James Goodman
j.goodman00@btinternet.com

Replies continue below

Recommended for you

RE: before update & subforms

James,

I ran into the same problem before. The simplest solution is to create s "Save" button to activiate the sub you wrote. In this way, you let users decide when the record is updated.

This solution is not automatic to users, but intuitive. What do you think?

Seaport

RE: before update & subforms

(OP)
I understand the idea, but i would have thought that as soon as you switch to the subform, it triggers the save event automatically, thus updating the source table. Therefore any history routine which then runs would surely save the new record, not the existing one??

James Goodman
j.goodman00@btinternet.com

RE: before update & subforms

(OP)
As an update on that, I am wondering if it is possible to let the routine run, but store the variables temporarily. Then when the end of the form (mainform) is reached, trigger the 'ask to save' sub, along with the history update sub.....

Has anyone ever tried this? I see it being quite a lot of work, but in theory it should be possible....

James Goodman
j.goodman00@btinternet.com

RE: before update & subforms

It is a good idea theoretically. However, it is not feasible for me, at least. I have more than a dozen data entry forms in the database. Most of them have subforms. I can not implement this idea to all of them.

Access just cannot differentiate two situations of saving records: going to the subform and all other actions. This causes all the troubles we have.

Maybe you can think about unbound data entry forms. However, there are also lots of programming to do.

Seaport

RE: before update & subforms

(OP)
yes, that is the way i am thinking of doing it....using unbound controls, & storing values temporarily before appending the whole lot to the table...i see it being highly problematical though

James Goodman
j.goodman00@btinternet.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close