Results 1 to 4 of 4
  1. #1
    claysea is offline Novice
    Windows XP Access 2007
    Join Date
    Feb 2012
    Posts
    20

    Query Subtotals???

    I have the following information in a query:

    ID Name Date Amount
    12-100 John Doe 1/16/2012 $126.50
    12-100 John Doe 1/26/2012 $126.50


    12-100 Jane Doe 1/15/2012 $150.32
    15-100 Jane Doe 1/20/2012 $138.00
    15-100 Jane Doe 1/31/2012 $126.30
    21-100 Jim Doe 1/02/2012 $105.00
    21-100 Jim Doe 1/10/2012 $126.30

    I am trying to find a way to get the query to subtotal each person's bill based off of their ID. I know it can be done in a report, but I am trying to do it in a query because I need to export it to excel afterwards to send to someone else in my office.

    P.S. I don't know how to do macros or unions...I am a novice.

  2. #2
    jzwp11 is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2010
    Location
    Dayton, OH
    Posts
    2,901
    You would need a simple aggregate query. The SQL text of the query would look like this

    SELECT ID, [name], Sum(Amount) as SumOfAmount
    FROM YourTableName
    GROUP BY ID, [Name]


    You would not include the date field in the aggregate query.

    If you want to do this using the query design grid, select the table and the 3 fields above. Right click on the amount field and select totals from the menu. Change the Group By row for the amount table to SUM. That should give you the equivalent to what I show above.

    A word of caution, the word "name" is a reserved word in Access so it should not be used as a field or table name. I would strongly recommend you change that field name.

  3. #3
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,848
    Wouldn't/Couldn't/shouldn't you just give the raw data and let the excel user do the subtotals?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,641
    Again:

    https://www.accessforums.net/showthr...total-on-Query

    If you want both detail and subtotals in the query, I think you have to go this route.
    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. Access Newbie - Query for Daily Subtotals?
    By malikastor in forum Access
    Replies: 3
    Last Post: 01-09-2012, 09:11 PM
  2. Replies: 2
    Last Post: 11-04-2011, 09:14 AM
  3. More detailed subtotals
    By kcmiuser in forum Queries
    Replies: 0
    Last Post: 06-27-2011, 06:10 AM
  4. Replies: 0
    Last Post: 11-17-2010, 01:21 AM
  5. Subtotals within a query
    By mulefeathers in forum Queries
    Replies: 2
    Last Post: 06-07-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