inserting calculations into a field in forms

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

Guest

Hello. Can anyone help me? In a form that I've made, I have a field where a
calculation is made from other fields. I want to store the results of this
calculation back into the table but I don't know how to do it.
I put the calculation into the 'default value' setting in properties and
then put the control source as the field where I want it stored, but the form
field appears blank.

I'd really appreciate any advice or guidance.

Thankyou very much,
Rachel
 
Default Value is too early. Access processes that before your other fields
have their values.

See:
Calculated fields
at:
http://allenbrowne.com/casu-14.html

The article explains when to store calculated results, how to do so (using
the AfterUpdate event of each control), and how to have Access give you
results without storing them when this will have you lots of issues (using
queries.)
 
Thankyou SO much for such a quick and helpful reply. I've been struggling for
days with this and appreciate your help so much!
Thanks again,
Rachel
 
Rachel said:
Hello. Can anyone help me? In a form that I've made, I have a field
where a calculation is made from other fields. I want to store the
results of this calculation back into the table but I don't know how
to do it.
I put the calculation into the 'default value' setting in properties
and then put the control source as the field where I want it stored,
but the form field appears blank.

I'd really appreciate any advice or guidance.

Thankyou very much,
Rachel

Allen properly answered your question about how, but I would suggest
WHY?

Generally it is better not to store the results of calculation in a
table. Access prefers to recalculate them and if you store them and then
edit one of the sources of the calculation your stored result when then be
wrong. Consider calculating the age of someone then storing it. On the
average it will become wrong in 183 days. If recalculated when needed, then
it will always be correct.
 
I'm running into the same issue as Rachel, The reason it would be helpful
to store a calculated value and not the component would be for purposes like
lab work. Ex) We measure sample pieces several times to get an average
thickness. We will never again use the individual thickness
measurements........just the final average. Maybe this is is similar to
Rachel's need.
 

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