Results 1 to 3 of 3
  1. #1
    rpgowned is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Aug 2011
    Posts
    1

    Running Sum

    I would like to do a query with a running sum.. It has been over a decade since i worked in access and I can't for the life of me figure out how to do it

    Table name Transactions
    Fields: ID, Date,Number,Transaction.Account,Change,Cleared

    ID is a PK
    I need to have the change field summed on each transaction line as Balance
    negative amounts are in parentheses



    if anyone could script this query quick for me would be greatly appreciated

    Nevermind I figured it out

    SELECT tbl_Alias.ID, tbl_Alias.Date, tbl_Alias.Number, tbl_Alias.Transaction, tbl_Alias.Account, tbl_Alias.Change, (SELECT Sum(Transactions.Change) AS Balance
    FROM Transactions
    WHERE (((Transactions.ID)<=[tbl_Alias].ID)) AS Balance, tbl_Alias.Cleared
    FROM Transactions AS tbl_Alias;

  2. #2
    gopherking is offline Advanced Beginner
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    71
    rpgowned,

    I had this same question a while ago, but there is no easy answer for doing a running sum in a Query (or at least I haven't received it yet either), but I did come across the following which explains how you can set it up (I didn't bother due to the complexity and I didn't need it that bad; I just used a Report to do it for me since that was where I needed the running sum anyway):

    http://msaccesstips.com/2010/01/auto...-query-column/

    If it helps, glad I could contribute!

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,642
    A running sum is typically done either with a subquery or a DSum(). Either one would have a criteria that summed all previous transactions including the current one. That would involve the date field, and perhaps another field if there could be more than one transaction on a date. Searching on "running sum" should turn up lots of examples.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Query with a running sum
    By is49460 in forum Queries
    Replies: 3
    Last Post: 09-07-2013, 11:11 PM
  2. Running total
    By lololthis in forum Queries
    Replies: 5
    Last Post: 06-21-2011, 04:14 PM
  3. Running a module
    By KevinMCB in forum Modules
    Replies: 2
    Last Post: 03-09-2011, 02:38 PM
  4. Running Sum by Date - Help
    By hackfifi in forum Queries
    Replies: 2
    Last Post: 02-08-2011, 07:07 AM
  5. Running two SQL Statements
    By jo15765 in forum Access
    Replies: 3
    Last Post: 11-21-2010, 01:02 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums