store a value of a text box that calculates data into a data sourc

  • Thread starter Thread starter BZeyger
  • Start date Start date
B

BZeyger

I have a form that does numerious things. There are many text boxes that
contain values. What I am tring to do is store a value from a text box that
calculates a total, then tie that total into a record.

There is a form the has many lines in the detail section:
Project/Writer Hours/ Art Hours

The footer section has the totals of the details:
Total Writer Hours/ Total Art Hours/ Total All

The textbox for the sum contains "=Sum([Writer hours])" in Control Source
section
The textbox for the sum contains "=Sum([Art hours])" in Control Source section
The textbox for the total contains "=((Sum([Writer hours]))+(Sum([Art
hours])))" in Control Source section.

I would like the textbox for the total to be stored in a specific field in
the Projects table named "Total Hours".

How would I do this?
 
Hi

You could of course store the value but what happens if someone works a few
more hours - you will need to over write your field. So you may as well just
have the calculation result on the form - or in a query if you want to use it
for other stuff
 
I have a form that does numerious things. There are many text boxes that
contain values. What I am tring to do is store a value from a text box that
calculates a total, then tie that total into a record.

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.

There might be some instances where there is a DEMONSTRATED
need to store the result, say because the calculation involves so many records
that it's unacceptably slow. But storing the total would be a last resort.
 
Back
Top