That kind of task is usually more of a kind of Excel task than an Access task. Relational databases really don't have that kind of relationship within records in the same table.
That being said, I know it can be done using ADO or DAO in VBA and looping through RecordSets and storing the result in a table. However, that wouldn't be dynamic, and if the any records are deleted, inserted, or re-sorted, your numbers probably won't look right.
Might I ask what exactly you need to do this for? If I understand your end goal, I may have some other suggestions for you.
If you are interested in a VBA solution, please let me know, and let me know how your records are ordered.