Calculations in Forms

  • Thread starter Thread starter rciolkosz
  • Start date Start date
R

rciolkosz

Is it possible to add two numbers together in a form field and drop the
result in the table?
 
Forms display data, tables store data. For that to work, you'd have to tell
Access how to get the calculated value into the table.

HOWEVER!!! It is rarely necessary to store a calculated value in a table.
More often, it is sufficient (and less risky when you think about data
integrity) to use your table to store the components, then use a query (or a
form) to do the calculation on-the-fly.

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
Is it possible to add two numbers together in a form field and drop the
result in the table?

Yes. But DON'T.

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.
 
Back
Top