Try this:
//{@accum}:
whileprintingrecords;
numbervar x;
numbervar y;
datevar z;
if x <= 10000 then (
x := x + {table.amount};
z := date(0,0,0)
);
if x > 10000 then (
y := y + 1;
x := x-10000;
z := {table.date}
);
x
Create a second formula to display the date when $10,000 has been achieved:
evaluateafter({@accum});
whileprintingrecords;
datevar z;
If your amount field is a currency, change "numbervar" to "currencyvar" in all places.
This formula will return the current cumulative total until the record where the total exceeds 10,000. On that record, the balance of the cumulative total minus 10,000 will be displayed, and the accumulation will continue. Not sure what exactly you wanted to display on that record. The date field will indicate that that record was the one where 10000 was reached, like this:
Amt Cum Date
6500 6500
3000 9500
4000 3500 1/16/2012
5000 8500
6000 4500 2/12/2012
7000 1500 2/13/2012
4000 5500
//etc.
You could add a another formula that just displays 10000, by using a formula like this:
evaluateafter ({@accum});
whileprintingrecords;
datevar z;
if z <> date(0,0,0) then
10000 else
0
Then suppress this if zero.
-LB