Hi John,
It's not that I have to leave the subform repeatedly. The user may click
somewhere on the main form during the time entering subform.
Well... the subform data will only be saved if the user sets focus to some
bound control on the mainform; a random click on the background won't do it.
Also, after the
data entering is finished, double clicking Total textbox on the main form
will trigger the double click event to calculate the total.
Ummm... why is a doubleclick needed?? A calculated field should reflect the
current sum; at the worst you could recalc or requery the textbox in any
subform event which would affect the total. You're not STORING the total in
the table, I hope?
On the subform, all of the textboxes are bound, so the data will be saved
when they are entered. But other tables need to be updated after the form is
finished. I want to use a program to do this work.
To be precise, the data will NOT be saved after each textbox is filled; it
will only be saved when the entire subform record is saved, i.e. by moving to
a different record or by leaving the subform.
If there is potential that the update may happen a few time, then I will have
to check the tables to see whether the information has already been there
before doing the update. There may be some better way to do it, please advise.
The process of updating the other tables will need some sort of signal from
the user indicating that they're done. If you're doing calculations on the
data in these tables, to store the calculated values in some OTHER tables, you
probably should not be doing so at all; please explain! Here's my standard
blurb on the subject:
Storing derived data such as this in your table accomplishes
three things: it wastes disk space; it wastes time (almost
any calculation will be MUCH faster than a disk fetch); and
most importantly, it risks data corruption. If one of the
underlying fields is subsequently edited, you will have data
in your table WHICH IS WRONG, and no automatic way to detect
that fact.
Just redo the calculation whenever you need it, either as a
calculated field in a Query or in the control source of a Form or a Report
textbox.