PC Review


Reply
Thread Tools Rate Thread

running total of records in query

 
 
alecgreen
Guest
Posts: n/a
 
      4th Feb 2012
Hi

I want to show a running total of the records in my query. By this I
mean, if I run my query and 5 records are displayed I get 1,2,3,4 and
5 (in a calculated field in the query) against each record. If my
query shows 9 records I get 1,2,3,4,5,6,7,8 and 9 and so on. I been
trying to do this for days now!

Many Thanks

Alec
 
Reply With Quote
 
 
 
 
Bob Barrows
Guest
Posts: n/a
 
      7th Feb 2012
alecgreen wrote:
> Hi
>
> I want to show a running total of the records in my query. By this I
> mean, if I run my query and 5 records are displayed I get 1,2,3,4 and
> 5 (in a calculated field in the query) against each record. If my
> query shows 9 records I get 1,2,3,4,5,6,7,8 and 9 and so on. I been
> trying to do this for days now!
>

Stock answer: why do it in the query? Do it in a report.

Longer answer: if your results can be ordered without ties, a subquery can
be created to count the records whose values in the ordering fields are less
than or equal to the values in the current record. More details are required
if you need a more specific answer.
Alternatively, create a table with an autonumber column and insert the
results into it. Then select the numbered results from the table. This will
require VBA code to automate it, since the table has to be created each
time. If you do take this route, you should prevent database bloat by using
VBA to create a temporary database file in which the table with the
autonumber field is created. Delete the database file after selecting the
records from it.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
running total and average of that total after 3 events =?Utf-8?B?YmVsdnkxMjM=?= Microsoft Excel Misc 0 28th Mar 2007 02:57 AM
RE: running total and average of that total after 3 events =?Utf-8?B?VG9wcGVycw==?= Microsoft Excel Misc 1 28th Mar 2007 02:19 AM
% of Running Total to Grand Total in Pivot Table =?Utf-8?B?RGF2aWQ=?= Microsoft Excel Programming 0 17th Aug 2005 08:24 PM
How Can I calculate a running total (prior total - expense)? =?Utf-8?B?VmljdG9y?= Microsoft Access Forms 0 5th Jul 2005 07:32 PM
Report showing current total, previous total and average total? Richard Black Microsoft Access Reports 3 20th Jul 2004 01:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:07 AM.