Results 1 to 2 of 2
  1. #1
    Romulus is offline Novice
    Windows 8 Access 2007
    Join Date
    Oct 2015
    Posts
    6

    Recursive total

    I have a report based on a query that conunts items based on date elements, sorted by year and month.
    After each year I have a subtotal and a grand total at the end of report,
    I need do have a recursive total on each month. New month total = Last month total + new month count value returned by query

    Example
    Year Month Count Total
    2007
    January 5 5
    February 10 15
    March 4 19
    Total 2007 19 19


    2008
    February 2 21
    May 8 29
    June 4 33
    Total 2008 14 33
    Grand Total 33

    Thank You

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,933
    depends on how your data is structured but your would either use a subquery or the dcount function

    something like

    Total: (SELECT count(*) FROM myTable as T where Monthnum<=myTable.Monthnum)
    or D

    Total: COUNT("*","myTable","Monthnum<=" & Monthnum)

    Both of these assume Monthnum is a number - 1=Jan, 2 =Feb etc

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

Similar Threads

  1. Is a recursive query possible?
    By nigelbloomy in forum Queries
    Replies: 3
    Last Post: 09-10-2015, 04:04 PM
  2. Need help with recursive design
    By frankos72 in forum Database Design
    Replies: 12
    Last Post: 10-09-2013, 08:04 AM
  3. Recursive data
    By jvrsoto in forum Access
    Replies: 4
    Last Post: 12-20-2011, 10:56 AM
  4. Recursive Report!
    By Rawb in forum Reports
    Replies: 7
    Last Post: 01-26-2011, 04:00 PM
  5. Recursive Tables!
    By Rawb in forum Database Design
    Replies: 1
    Last Post: 01-26-2011, 02:46 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