View Full Version : Sum Calculation


Haytham
12-04-2001, 09:06 AM
Hi All...
I have a form based on a query to get the sum of expenses.
The fields are No., Amount, Tick, Description.
I build expression in query in a way that, if tick is -1 then + else -.
e.g. Amount 1000 Tick + it's 1000
Amount 200 Tick - it's -200 etc.
I created an Unbound Field in the form (Tabular form) to calculate the sum of Amount. So, I should get in the first record 1000 and in second record 800, which is (1000-200) and so.
It's not working..
Any help please

The_Doc_Man
12-05-2001, 09:59 AM
One of my first home-grown apps (a long time ago) was a checking account tracker that included deposits, interest, corrections, fees, and checks. I had the same issues of a "code" that told me whether it was debit or credit, yet I always showed the value as though it were a credit (i.e. unsigned).

After playing around with this for what seemed like ages, I fixed it by adding a "net value" field that was not visible on forms, but it got updated when the value field or the transaction type field got updated. My sums were based on the net value field, not the displayed value. In the end, that turned out to be the easiest way to approach the problem in a reliable and relatively quick manner.

There are those in the forum who say you should NEVER store a computed value. I would counter that when it is more work to recompute the value every time you need it than to compute it once and store it, you have defined a reason of practicality to store a computed value.

Haytham
12-06-2001, 06:12 AM
Well, with disregard of storing the computed value, how can I display a value in the form for the rest of every transaction..
Ok, I don't want to store all those values but the user should see the result for every step.
By creating unbound field and writing the code or expression will not show the result for a specific record, but for the total.
Someone told me to use RunningSum Code but I don't know how to do it.
I tried to go th' help but still the same... Any more help please

Rich
12-06-2001, 06:52 AM
What's still the same, you can't find a reference or don't know how to use it?

Haytham
12-06-2001, 07:10 AM
Hi , Still the same means in the unbound field I can't get the sum result of the specific result. It calculates the whole records sum.
i.e. my first record unbound result is 1000
My second id Credit 1000 So result should be 2000
Third record is Debit 200 so 2000-200=1800
This result in the Unbound Field should not change
So 2000 in the second record should remain as it is and not 1800
I hope my point is clear
db can be send if necessary
Thanks a lot.