Page 1 of 2 12 LastLast
Results 1 to 15 of 26
  1. #1
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338

    Running sum by date

    Hello



    I would like to get running sum. Here is the example

    Date DepositAmount WithdrawalAmount RunningSum
    10/01/2012 0.00 225.65 -225.65
    10/03/2012 775.00 0.00 549.35
    10/04/2012 775.00 0.00 1324.35



    Thank you

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    This can easily be done in reports. Textbox on report has a RunningSum property.

    Calculate the difference of Deposit and Withdrawal in query or report textbox, set RunningSum property of textbox that holds the calculated value.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Thank you for your reply. After posting thisthread i notice i should do this in reports. I just posted a new thread inreports. How do i get last month ending balance into current month???

    Date DepositAmount WithdrawalAmount RunningSum
    Beginning balance 200.00-(This is September balance)
    10/01/2012 0.00 225.65 -25.65
    10/03/2012 775.00 0.00 749.35
    10/04/2012 775.00 0.00 1524.35

    Thank you

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Can do a nested subquery that sums the data through September. Review the example for Year To Date in http://allenbrowne.com/subquery-01.html

    I deleted the other thread as it just duplicates this one.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    June7

    I looked at the link. Sql is a foreign language to me. Do you have an other links i can look at???


    Thank you

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Access query objects use SQL. Open in SQL View and study the sql statement. That is one way to get familiar with SQL structure. Another is tutorials. Here is one site http://www.w3schools.com/sql/default.asp
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    June7

    I got it to work.
    YTD: DSum("DepositAmount","Query2","MonNum>='" & [Newdate] & "'")

    How can i subtract WithdrawalAmount field???

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    I never had to build report like this (I don't work with accounting type databases). Beginning/Ending balances not something I have to deal with.

    But think this is possible method:

    Have the beginning balance calculated in a textbox in report or group Header.

    Then calculate ending balance in a textbox in report or group footer. Something like:

    = Me.textboxBeginning - Sum(DepositAmount - WithdrawalAmount)

    However, don't know if a running sum that includes the starting balance can be accomplished.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    So the query is not working right. Its not giving me running sum by month and year.

    Can any one else help me????

    YTD: DSum("DepositAmount","Query2","MonNum>='" & [Newdate] & "'")

  10. #10
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Want to provide db for analysis? Follow instructions at bottom of my post.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    Sure. look at query3


    Copy of 720.mdb


    Thank you

  12. #12
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    YTD: DSum("DepositAmount","Query2","MonNum>='" & [Newdate] & "' and Year = '" & [year] & "'")

    I'd strongly advise you not to do running sums in queries though, particularly with large datasets. It is incredibly inefficient when compared to doing the same function on a form or report.

  13. #13
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    rpeare

    Thank you for your reply. I really need this on reports. How can i do it in reports??? Also need the report to start with a text box showing previous month balance. The user would run report by month.

  14. #14
    Ray67 is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    338
    rpeare

    I did the running total in reports. So all i'm missing is how to show previous month balance.

    Thank you

  15. #15
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,648
    Activate the Report Header section.

    Create a textbox in that section.

    Expression in textbox ControlSource:
    =DSum("[DepositAmount]-[WithdrawalAmount]","T_Transactions","[TransactionDate]<#11/1/2011#")

    Notice the static date criteria. Making this dynamic is another issue. Can be a reference to textbox on form.

    The report is bound to a query that is filtered only by DateCleared. This means duplication of data that was used in the StartBalance calc.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Running Total Based on a Date in a field
    By scratchmb in forum Access
    Replies: 4
    Last Post: 02-15-2012, 05:31 PM
  2. Prompt User for Date Range when running QUERY
    By taimysho0 in forum Programming
    Replies: 3
    Last Post: 01-30-2012, 11:49 AM
  3. Replies: 10
    Last Post: 11-06-2011, 01:30 PM
  4. Replies: 1
    Last Post: 03-05-2011, 03:05 PM
  5. Running Sum by Date - Help
    By hackfifi in forum Queries
    Replies: 2
    Last Post: 02-08-2011, 07:07 AM

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