Calculation in Subform To Table

  • Thread starter Thread starter Nate via AccessMonster.com
  • Start date Start date
N

Nate via AccessMonster.com

Hi

I am calculating two fields in a subform, Quantity and Price. I placed
this code =[dollaramount]*[quantity] in my TotalPrice textbox control
source to get the total for the parts. This calculation works fine.

My question is how do I get this to store in a my table? Since I placed it
in my control source, I cannot link it to my table.

Thank
Nate
 
Why would you want it in your table? That would be redundant. If your
table already stores the amount and quantity, then you can recalculate the
total price any time you need it. If you store that, what happens if
someone changes the quantity or the price? How will access know to go back
and update the total?

This is pretty common. If you do some searches you will find hundreds of
messages stating that calculated values should not be stored. I have seen
at least two today alone!

That being said, there are cases where you would store calculated figures if
you need to capture a snapshot in time for items that might change, but from
your description that would not apply to the total prince. It MIGHT apply
to the dollar amount. If that is being obtained from another table (say a
product price list) and if that value could change over time (price
increases) then you may indeed want to record the "current" price in your
table at the time you create your invoice record.

Wrap your head around those ideas and post back if you need further help.

Rick B
 
Background:
My DB is for recording the repair to a certain truck in out fleet. I have
a repair form with all repair info and a subform that lists part numbers
and price and quantity that was used for the truck. I need to be able to
go back and check how much was spent fixing a certain truck on a certain
date. Or even how much was spent repairing the truck for the year.
So are you saying it is better to try to use a query to calculate and
forget trying to store a calculation for each repair done?
If so can you give me some pointers on how to accomplish this? I am not a
very fluent access user.

As far as I know once a repair is done to a truck and it is entered into
the form, that will be it. I don't see where we would want to go back and
edit a repair record. I just thought it would be easier to query the
amount spent on a truck if all the totals for each repair were in a table.

Thanks for you help
Nate
 
Back
Top