storing calculated form fields to a table

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

Guest

Hello all,
I have a form field which has as its control source a calculation that takes
the sum of a subform, this works great and on the form the details are
presented as i wish, however the company i am working for wish this total to
be stored in the underlying table so that it can be used in other
calculations. How can i do this?

Ive had to use the control source to calculate all the totals and
differences on this form as im workign with a subform, is there a way i could
do this in VB?

with great thanks

Amit
 
typically, you would not store a claculated value in a table. What happens
if one of the values (upon which the total is calculated) changes? Who goes
back and fixes the stored total?

If you need to use that total in other calculations, then simply calculate
it in your query/form/report and then use it in your calculation.

Rick B
 
Yup thanks Rick,

I told my boss that and he is adamant that there be a way to store the
value, as he puts it, 'its essential', so i guess i have to find a way to do
it.

with thanks

Amit
 
If you create a query that includes the calculation in it, you can use the
query wherever you would otherwise have used the table.
 
DowningDevelopments said:
Yup thanks Rick,

I told my boss that and he is adamant that there be a way to store the
value, as he puts it, 'its essential', so i guess i have to find a
way to do it.

Go to your boss with the following thought experiment...

Using Excel with a set of numbers in column [A] and another set of numbers
in column . You want the product (A*B) to be in column [C]. Would it be
better to...

a) Put the expression =[A1] * [B1] in the first row and copy that down the
page.

....or...

b) Write a macro that traverses the rows, does the calculation, and places
the result into column [C].

Option (a) is the obvious choice with option (b) being such a silly idea
that no one would even consider it.

Option (a) is the Access equivalent of putting the calculation into a query,
form, or report and letting your computer calculate the value on the fly.
It's obvious advantage is that you can change any value in column A or B and
know that the correct result will show in column C without having to
remember to re-run a macro.

Option (b) is the Access equivalent of writing code that will calculate the
value and stuff it into a bound control so it will be saved to the table.
Yes, it can be done, but it is NOT a good idea.
 
Back
Top