It's hard to improve on what Tom Ellison just said, but I thought an
example might be illustrative. I'll add up successive numbers to get a
list of triangular numbers (such as 10 bowling pins in a triangle of 4
rows).
I start with a Table of the numbers to be added:
[Counting] Table Datasheet View:
Integer
-------
1
2
3
4
5
Then I define a Query to accumulate the totals, but display the results
in the reverse order:
[Q_TriangularNumber] SQL:
SELECT C.Integer, Sum(T.Integer) AS [Triangular Number]
FROM Counting AS C, Counting AS T
WHERE (((T.Integer)<=[C].[Integer]))
GROUP BY C.Integer
ORDER BY C.Integer DESC;
And the results show the cumulative totals (displayed in the order I
chose, which would be tricky in a Running Sum field in a Report). As
Tom pointed out, if you have duplicate values (which I sneakily avoided
here), you need to take them into account, such as via the Table's
primary key.
[Q_TriangularNumber] Query Datasheet View:
Integer Triangular Number
------- -----------------
5 15
4 10
3 6
2 3
1 1
But you have other options as well (and not just copying the whole Table
to Excel, either). For example, you could (and I sometimes do) print
your Report to the "Generic / Text Only" printer, a useful device even
though mine didn't cost me as much as my color inkjet model. (If you
don't have one in your list of printers, open Control Panel --> Printers
and Faxes, then choose Add Printer and select the Print To File option.)
I usually get my best results with this by making a copy of the Report
design I wish to produce, and on the COPY changing the fonts on all the
controls to Courier 12 point (or similar) and erasing all the rules and
other fancy decorations that the Report Wizard added. It doesn't look
great but works well as a text file. After writing to the file, check
to be sure that you have everything -- Access likes to not bother you
with overflow messages, preferring to just truncate strings that are too
long. (Or maybe I've missed a global setting somewhere.)
-- Vincent Johns <
[email protected]>
Please feel free to quote anything I say here.