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

    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
    357
    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
    8,923
    you don't DSUM in a query, you just SUM.
    (turn on the summation button.)

  4. #4
    Welshgasman is online now Expert
    Windows 10 Access 2007
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    993
    Group by CarID and sum the relevant field ?
    Please, please use # when posting code snippets.
    Cross Posting Etiquette: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?search_query=debug+access+vba



  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    50,140
    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. Replies: 1
    Last Post: 02-04-2020, 01:29 PM
  2. DSUM Running total by group
    By chowing0823 in forum Access
    Replies: 8
    Last Post: 03-02-2015, 09:12 AM
  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 - Senior Forums