View Full Version : Please need your help


mastidude
04-13-2008, 07:45 AM
Hi guys ! I need your help

I am working on a project through which I hope to learn Access as well !!


Well I have read that we should not store calculated fields in tables but I have a requirement. I will tell you why!

I am working on creating a Db where the user can enter values through a form and automatically calculates sales Tax values etc.. Now I want these calculated values to be sored .. why?

Cause after every 3 months I want the Db to calculate all individual bills and tax values of these items and show up in a new Form/table.. unless the caluclated tax values r stored in table i can't perform addition operation for all bills of 3 months!!!


I hope u understod what I meant.. so please help me out!

Regards

RuralGuy
04-13-2008, 11:04 AM
Your reason to store the calculated value does not hold water. You could easily create a query that calculates the tax on the fly and use that query as the input to something else. Now if the Tax Rate were subject to change then there would be an historical reason to store the calculation that was in effect at the time.

gemma-the-husky
04-13-2008, 12:29 PM
mastitude, to do this,

simply have an extra field in your table, and calculate it when you save your line calculation. - its not hard, its jst normally not good practive, as RG says.

-------------
however, this is one occasion when i would consider stroing a calculated value, but not for the reason you are considering - as generating results for a period of time is trivial.

There are two reasons I would consider storing the calculation
1 - invoices never change after they are raised, so the value is going to be permanent, and it may be more efficient not to have ot keep calculating the value
2- The other reason is to avoid having to consider roundings.

in UK, sales tax/VAT is 17.5%

so say you have a customer with 4 lines on an invoice as follows

Goods Tax Tax Rounded
123.70 2.16475 2.16
123.70 2.16475 2.16
123.70 2.16475 2.16
123.70 2.16475 2.16
--------------------
494.80 8.6590 8.64

so calculating sales tax by line, and rounding each one gives a total of 8.64
and calculating based on the overall total is 8.66

both are legal, and its a matter of taste which method you use.

however, i realy think it is easier and quicker to store the calculation result in this scenarion

mastidude
04-20-2008, 11:03 PM
Hi there!


Well I want to explain in detail

Suppose there r 10 billings in a month of PArticular PArty A

and The user inputs the value of each bill in a form ,then he gets a Net VAlue after TAx is calculatd in form itself

Now I want that after 3 months lets say there are 30 billings.. I want that 30 calucalted fields total.. and a tax of 4 percent on tht (Quaterly)

Now my point is that if I don't store cALCUlated values in table.. how will I perform "ADDITION OPERATION" AND CALUCLATED total of 3 months

CAN U GIVE ME SYNTAX FOR STORING VALUES IN TABLE???
tHANXXX

namliam
04-20-2008, 11:49 PM
Your reason to store the calculated value does not hold water.
I am with RG on this one... DONT store calculated values. :eek:

Any calculated value can be re-calculated in a query/function. Then using some sumation function on a report or in a query you can total them, no matter if they are calculated or not.