I happens that I need to do a running total in a report, and I can't use the built in 'running total' feature for some reason or another. (the current issue is that I need a running total on a formula field that exists only in a group footer)
The code to do the deed is kind of a pain, but here it is.