For this:
1- You can use SQL and filter using the clause WHERE and not process all records..
SELEC SUM(?) From ? Where Field=Condition
NOTE: If you use buffering, this is not the best way. SQL no "see" the changes in the buffer..
OR..
2- Use SUM with FOR clause OR
3- Create SCAN..ENDSCAN loop
The Life is Beautiful!
Programmer in
Delphi, VS.NET
MCP