Results 1 to 5 of 5
  1. #1
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486

    using dsum in query for each record (not running total)


    I would like to use a dsum that I use on my form but in my form I reference the Current record ID. Can you do something like this in the query. In the query there is not active id showing, so I am not sure how to do this.

    basically I want to query a list of cars and for each car show a total for the repairs done. I do this in the form by referencing the car id, but I can't do that in the query

    I am not looking to get a running total, just the total repairs for each car.

    Thanks for any help.

  2. #2
    tagteam is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2013
    Posts
    486
    I know what I can do it using a sub query and that works. I was just wondering if there was any way to do it with a dsum.

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    you don't DSUM in a query, you just SUM.
    (turn on the summation button.)

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Group by CarID and sum the relevant field ?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    So you need to sum data in another table? You have it working with a subquery? Why is subquery needed and not just joining tables and use aggregation?

    Yes, DSum can do it but can cause slow performance in query and form.

    Or build a report and use its Sorting & Grouping with aggregate calcs. This allows display of detail data as well as summary info
    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. DSUM Running total by group
    By chowing0823 in forum Access
    Replies: 10
    Last Post: 10-07-2022, 03:15 AM
  2. Replies: 1
    Last Post: 02-04-2020, 01:29 PM
  3. Replies: 6
    Last Post: 11-05-2014, 03:00 PM
  4. Replies: 34
    Last Post: 03-03-2014, 09:24 AM
  5. Replies: 2
    Last Post: 12-05-2012, 02:41 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