PC Review


Reply
Thread Tools Rate Thread

Building an accumulator

 
 
Victoria
Guest
Posts: n/a
 
      3rd Jun 2009
Sorry for the crosspost- trying to get this question to the most appropriate
group.

I am working on a project where I need to build an accumulator in access.
Basically, it would accumulate visits on a subid, memno level by date of
service. So if a subid/memno combination had 50 rows, each with a variable
amount of visits, it would create or populate a new column with the summation
of visits to that point based on date of service. Thus, the value would be
different at each row because it would continue to accumulate by date of
service.

My guess is that this can be done with a module, I just don't know how.

Please help!!!

Thanks,
Victoria
(E-Mail Removed)

 
Reply With Quote
 
 
 
 
John Spencer MVP
Guest
Posts: n/a
 
      3rd Jun 2009
Normally this would be handled in a query and the data would not be stored in
a field in a table.

If you search for running sum you will probably find some examples of what you
are seeking.

The query might look something like

SELECT A.SubID, A.MemNo, Sum(B.Cost) as Total
FROM TableName as A INNER JOIN TableName as B
ON A.subID = B.SubID
AND A.Memno = B.MemNo
AND A.DateField <= B.DateField
GROUP BY A.SubID, A.MemNo

Or you could use a subquery to do the same thing

SELECT A.SubID, A.MemNo
, (SELECT Sum(Cost) From TableName as Temp WHERE Temp.SubID = A.SubID AND
Temp.Memno = A.Memno AND Temp.DateField <= A.DateField) as Total
FROM TableName as A


John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County

Victoria wrote:
> Sorry for the crosspost- trying to get this question to the most appropriate
> group.
>
> I am working on a project where I need to build an accumulator in access.
> Basically, it would accumulate visits on a subid, memno level by date of
> service. So if a subid/memno combination had 50 rows, each with a variable
> amount of visits, it would create or populate a new column with the summation
> of visits to that point based on date of service. Thus, the value would be
> different at each row because it would continue to accumulate by date of
> service.
>
> My guess is that this can be done with a module, I just don't know how.
>
> Please help!!!
>
> Thanks,
> Victoria
> (E-Mail Removed)
>

 
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
Building an accumulator in access- module or query and how to? Victoria Microsoft Access Queries 1 3rd Jun 2009 07:53 PM
Accumulator BadBoy Microsoft Excel Worksheet Functions 1 24th Apr 2009 12:25 PM
Re: Accumulator Dave Peterson Microsoft Excel Worksheet Functions 0 23rd Apr 2009 07:12 PM
accumulator with other than one =?Utf-8?B?RGFu?= Microsoft Excel Worksheet Functions 8 24th Nov 2006 06:29 PM
Please help fix my accumulator Tim McMahon Microsoft Excel Programming 3 23rd May 2004 09:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:28 PM.