I have a form which is bound to a table. On this form I
have a calculated field. The calculation is the sum of
two other field values. How can I get the value of the
calculated field to write to a specific field in the
table?
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 just as you're now doing it -
in the control source of a Form or a Report textbox.
If you have some good reason to do so (for instance, if you WANT to be
able to change one of the fields yet have the sum remain unchanged),
you can use VBA code in the Form's BeforeUpdate event to set a bound
textbox equal to the value in the calculated textbox.