calculation in access form linked to table field

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am building a stock database for my business. So it is easier for novice
users to keep it up to date I was using a simple form and wanted to do
calculations between edit boxes. The edit boxes are bound to a table which
the form is linked to. The calculation consists of edit box 1 minus edit box
2 = edit box 3. How could i do this calculation within the form and still
link it to the table.

Please help thanks

Marc
 
You should not store calculations in your table, just the raw data values.
Calculations can be performed on the form & will therefore automatically
re-calculate with the latest data from the table when the form is opened.
On your form, edit box 3 is not bound to any data in your table and the
control source should be set to
=[EditBox1]-[EditBox2]
 
I am building a stock database for my business. So it is easier for novice
users to keep it up to date I was using a simple form and wanted to do
calculations between edit boxes. The edit boxes are bound to a table which
the form is linked to. The calculation consists of edit box 1 minus edit box
2 = edit box 3. How could i do this calculation within the form and still
link it to 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.


John W. Vinson[MVP]
 
Thankyou Dennis and John.

I have used a query to calculate the result and then linked the form i
needed to this query. this solved the problem.

thanks again

John Vinson said:
I am building a stock database for my business. So it is easier for novice
users to keep it up to date I was using a simple form and wanted to do
calculations between edit boxes. The edit boxes are bound to a table which
the form is linked to. The calculation consists of edit box 1 minus edit box
2 = edit box 3. How could i do this calculation within the form and still
link it to 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.


John W. Vinson[MVP]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top