On 26 Feb 2006 00:21:23 -0800, "shotokan99" < XXXX@XXXXX.COM >
You can add a field object to a TDataSet. Then define the new field as
Calculated as the sum of one of the underlying table fields. The sum
then appears in the dataset. Be careful to keep in mind that a sum
field in a multi-row dataset doesn't make much sense. Check out the
SQL SUM and COUNT functions, for example. They make sense only if the
query returns a single row (or a GROUP of different sums). This means
getting a list of values and a sum of them to appear at the bottom
means either two queries or do the summation in code.
Check out these topics in localsql.hlp.
BTW, using reals for currency calculations can cause problems due to
rounding errors. Look at using currency or integers. I'm not familiar
with all the problems and solutions, but I'm sure someone here has the
guidelines for you. Just ask.