Results 1 to 8 of 8
  1. #1
    aliaslamy2k is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    31

    Sum of each unique ID

    I want a formula where i can get to know the total amount spent on each vehicle


    Below is the screenshot for reference.
    Attached Thumbnails Attached Thumbnails SUM.JPG  

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,524
    You don't use DSUM in a query. The query does the sum.
    turn on query summation (on the toolbar),and put SUM under the amount fields.

  3. #3
    aliaslamy2k is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    31
    Hi Ranman,

    Thank you so much. I have followed your instructions and was able to get the total.
    My Requirement is to get the total amount spent on each vehicle as there are multiple entries of each vehicle number in database. below is the screenshot. May be my approach is wrong in calculating. Request your help on this please
    Attached Thumbnails Attached Thumbnails Sum1.JPG   Sum2.JPG  

  4. #4
    aliaslamy2k is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    31
    Below is the correct screenshot of first image.
    Attached Thumbnails Attached Thumbnails Sum1.JPG  

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    If you want total cost by vehicle, then do not group by driver.

    You have to be clear on what exactly should be summed. In post #4 you have SumOfCost and TotalCost (same values??)

  6. #6
    aliaslamy2k is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Apr 2020
    Posts
    31
    Hi Orange,

    My Apologize, by mistake i summed the field of "Cost". My Basic requirement is to show the total amount spent on each vehicle on form.
    below are the correct screenshots.
    Attached Thumbnails Attached Thumbnails Sum3.JPG   Sum4.JPG   Sum5.JPG   Sum6.JPG  

  7. #7
    Join Date
    Apr 2017
    Posts
    1,679
    When your lat post is for what you want, then you must not calculate total costs in query. You have to use DSum() to calculate total amount for unbound control in form.

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    As Arvil said, use DSum() in textbox on form - not a query.

    On a report - use Sorting & Grouping features with aggregate calc in footer textbox.

    BTW, looks like misspelling in field name Voilations - should be Violations
    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: 22
    Last Post: 03-03-2013, 02:00 PM
  2. Unique queries - Unique Count
    By bigfish in forum Queries
    Replies: 7
    Last Post: 03-14-2012, 01:28 PM
  3. Unique value in a subform
    By Rennie in forum Forms
    Replies: 2
    Last Post: 05-29-2011, 09:39 PM
  4. Unique ID problem
    By Remster in forum Access
    Replies: 10
    Last Post: 10-12-2010, 01:48 PM
  5. how to set a unique ID
    By archie in forum Access
    Replies: 1
    Last Post: 09-08-2009, 04:28 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