Results 1 to 2 of 2
  1. #1
    snifferpro is offline Novice
    Windows Vista Access 2007
    Join Date
    Aug 2009
    Posts
    3

    Sortyerd Report with totals

    I have a table (HoursTable) with 3 fields


    (DATE LOCATION HOURS)
    ( Date/Time Text Number)

    I want to produce a report sorted by Year and Month
    with totals of HOURS for each Year and Month, a subtotal for year,
    and a final total of HOURS at the end.

    It would look like this;

    HOURS WORKED

    Year & Month Hours

    2010 - 1 88
    2010 - 2 99
    2010 - 3 99
    2010 - 10 5

    Total for 2010 291


    2011 - 1 77
    2011 - 2 98

    Total for 2011 175


    2012 - 1 20
    2012 - 2 30

    Totals for 2012 50



    Total Hours 516


    I tried using the report wizard and I got this;
    Yearly/Monthly Totals

    Year - Month Hours

    2010 - 1 88
    2010 - 10 5 This should be after 2010-3
    2010 - 2 99
    2010 - 3 99
    2011 - 1 77
    2011 - 2 98
    2012 - 1 20
    2012 - 2 30

    _______________________516

    The Query for this is;

    SELECT Year([HoursTable].[DATE]) & "-" & Month([HoursTable].[DATE])
    AS YearAndMon,
    Sum(HoursTable.HOURS) AS SumOfhours
    FROM HoursTable
    GROUP BY Year([HoursTable].[DATE]) & "-" & Month([HoursTable].[DATE]);



    How do I do this in Access 2007.

    I am a rookie at this so specific examples would be very
    helpful.



    Thanks In Advance
    Last edited by June7; 03-03-2013 at 03:42 PM. Reason: MOD edit - remove bad code tags

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Problem is the Year - Month values are text not numeric so 10 sorts before 3. Need placeholder zero in the month.

    Year([HoursTable].[DATE]) & "-" & Format([HoursTable].[DATE],"dd")

    Use report Grouping & Sorting with aggregate calcs in footer textboxes. Access Help has guidelines on building this type report.
    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.

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

Similar Threads

  1. Report of just totals
    By TubbzUK in forum Reports
    Replies: 1
    Last Post: 02-12-2013, 11:15 PM
  2. Sub report totals
    By brownk in forum Reports
    Replies: 9
    Last Post: 01-11-2013, 02:59 PM
  3. Calculating totals in a report
    By Jamescdawson in forum Reports
    Replies: 20
    Last Post: 06-14-2012, 02:33 PM
  4. Totals Query for Report
    By SpdRacerX in forum Queries
    Replies: 3
    Last Post: 05-01-2012, 02:25 PM
  5. Replies: 5
    Last Post: 12-06-2011, 11:18 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