calculations in database form

S

sneeze

I have fields in my database that I have calculations that work but they do
not write the calculation into the table field. Anyone help?
 
S

Stefan Hoffmann

hi,

I have fields in my database that I have calculations that work but they do
not write the calculation into the table field. Anyone help?
The results of mostly all calculations shouldn't be stored. You can use
queries at anytime to get the results you need.

Despite that how do you calculate these results and why do you thing
they should be stored in a table. Can you provide a concise and complete
example?


mfG
--> stefan <--
 
S

sneeze

Thank you for your response. Fields are calculated in the form so that I can
see the result and if Tables are the only storage place of details then why
are the results written to the table from a calculated field in a form. Thank
you
 
S

sneeze

i might not have explained myself properly. I have fields [start] [end]
[total] where [total] = [end]-[start] with the correct result in the form. I
want that information stored (written) to the table with the same field name.
Thank you
 
L

Lynn Trapp

The problem you have is thinking that you need to store the result of the
calculation. If you can calculate it for your form, then you can also
calculate it for a query and/or report. Storing calculations is not the best
policy, except in rare circumstances.

--
Lynn Trapp
MCP, MOS, MCAS


sneeze said:
i might not have explained myself properly. I have fields [start] [end]
[total] where [total] = [end]-[start] with the correct result in the form. I
want that information stored (written) to the table with the same field name.
Thank you

sneeze said:
I have fields in my database that I have calculations that work but they do
not write the calculation into the table field. Anyone help?
 
J

John W. Vinson

i might not have explained myself properly. I have fields [start] [end]
[total] where [total] = [end]-[start] with the correct result in the form. I
want that information stored (written) to the table with the same field name.

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.
 

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

Top