Results 1 to 8 of 8
  1. #1
    Nixx1401 is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Feb 2010
    Location
    Barbados
    Posts
    115

    Calculating total values for groups in queries

    I have a dbase recording invoice totals for goods and services for vendors. I would like to create a query which provides the total invoice amount for each vendor by date and goods or service.



    The below is what I currently have but when I add the invoice date it is not adding the invoice totals

    SELECT tblVendor.strVendorName, tblTransactions.[Invoice Type], Sum(tblTransactions.curInvoiceTotal) AS SumOfcurInvoiceTotal
    FROM tblVendor INNER JOIN tblTransactions ON tblVendor.strVendorsID = tblTransactions.strVendorID
    GROUP BY tblVendor.strVendorName, tblTransactions.[Invoice Type];

    Basically I want the total invoice amount for a vendor for a given period and indicating the type whether good or service

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    What happens - error message, wrong results, nothing?

    Did you include the date in the GROUP BY?

    Build a report using Grouping & Sorting with aggregate calcs. This will allow display of details as well as group totals.
    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
    Nixx1401 is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Feb 2010
    Location
    Barbados
    Posts
    115
    When I add the date field to the query it does not add the invoice totals for each vendor it displays the invoice totals for goods and services individually for each vendor. I wanted to include the date field so you can enter a date parameter to reveal the total invoice amount for a vendor including if it is a good or service rendered or purchase.

    I tried using grouping and sum and display summary rather than details. With this one it adds the totals for goods and services for a particular vendor.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    Does the date include time part?

    Do you want to provide project for analysis?
    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
    Nixx1401 is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Feb 2010
    Location
    Barbados
    Posts
    115
    the date does not include time. I want to provide the total cost of goods and services for each vendor yearly and this information has to be exported to xml and emailed to accounts department.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    I won't be able to figure it out without directly analyzing the data. If you want to provide project, I will look at.
    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
    Nixx1401 is offline Competent Performer
    Windows Vista Access 2003
    Join Date
    Feb 2010
    Location
    Barbados
    Posts
    115
    I have attached the dbase

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,624
    If you only need date to determine the year so can summarize by year, need a field with year value. Extract the year from date with an expression. Use this constructed field as a GROUP BY value or to filter records by a year criteria.
    InvYear: Year(dteInvoiceDate)

    If you need separate totals for Goods and Services, include Type field in grouping. However, you have a query for each Type. Do you want separate reports?

    I usually prefer not to do grouping in a query and instead set grouping with Report. However, since you need to export to xml I expect that will have to be from a query and not a report. So if you want a total for each vendor by year and type, don't include full date in the query.
    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. Replies: 3
    Last Post: 12-01-2010, 12:30 PM
  2. Replies: 2
    Last Post: 10-25-2010, 10:45 PM
  3. Replies: 8
    Last Post: 05-24-2010, 04:24 AM
  4. Need help with calculating Time total
    By Monoceros in forum Reports
    Replies: 1
    Last Post: 04-20-2009, 12:44 PM
  5. Calculating Values
    By Jahan in forum Queries
    Replies: 1
    Last Post: 07-09-2006, 09:15 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