cooper,
this can be solved exactly the same way this one was: https://www.accessforums.net/forms/h...orm-12533.html
the sql I gave there was:
Code:
SELECT tblMoney.fldcode, tblMoney.flddate,
[fldvalue] +
iif(DSum("fldValue","tblMoney","[fldDate] < #" & [flddate] & "#") is null, 0,
DSum("fldValue","tblMoney","[fldDate] < #" & [flddate] & "#"))
+
IIf((DSum("fldValue","tblMoney","[fldDate] = #" & [flddate] & "# AND [fldCode] < " & [fldcode])) Is Null,
0, DSum("fldValue","tblMoney","[fldDate] = #" & [flddate] & "# AND [fldCode] < " & [fldcode])) AS Expr1
FROM tblMoney
ORDER BY tblMoney.fldDate;
this portion:ensures that the evaluated record's total field is added to the mix. The next section:
Code:
iif(DSum("fldValue","tblMoney","[fldDate] < #" & [flddate] & "#") is null, 0,
DSum("fldValue","tblMoney","[fldDate] < #" & [flddate] & "#"))
+
sums all of the previous records where the date is LESS than the date of the record being evaluated.
then you have the last portion:
Code:
IIf((DSum("fldValue","tblMoney","[fldDate] = #" & [flddate] & "# AND [fldCode] < " & [fldcode])) Is Null,
0, DSum("fldValue","tblMoney","[fldDate] = #" & [flddate] & "# AND [fldCode] < " & [fldcode])) AS Expr1
which is adding to the mix (if applicable), all the totals that have the SAME date as the evaluated record, but a lower ID number (e.g. - the lower ID numbers were obviously entered before higher ones)
and then of course you have to use an ORDER BY clause, which has to be executed first otherwise the totaling technique would not work:
Code:
ORDER BY tblMoney.fldDate, tblMoney.fldcode;
that's a different clause than originally posted, only because the post is a guess without actually working it.
So in your case, you'll use "Rev Due Date" as the date field and "MCount" as the field value from the above example. I will assume that also have an ID in an autonumber field somewhere?? If you do, you can copy that sql verbatim with name substitutes only. If you have no ID field, you'll have to make one, or another unique identifier. These kinds of things really can't be done without uniqueness, because the complexing would probably start overwhelming the sql engine.