Results 1 to 4 of 4
  1. #1
    justdone is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2020
    Posts
    5

    DSUM Multiple Criteria

    Table: Transactionstbl
    Fields:
    TransID - Autonumber
    CustomerID - Number
    Amount - Currency

    I made a query to display a running balance for the field Amount and named it as Balance

    Balance: DSum(“[Amount]”, “[Transactionstbl]”, “[TransID]<=“ & [TransID])

    The data somehow looks like this:
    TransID CustomerID Amount Balance
    1 3 20 20
    2 1 50 70
    3 3 10 80
    4 2 10 90

    As you can see, the running balance worked but I would like it to compute the balance per CustomerID, not all the transactions. I tried changing the query to
    Balance: DSum(“[Amount]”, “[Transactionstbl]”, “[CustomerID]=“ & [CustomerID]) but the data looked like this:

    TransID CustomerID Amount Balance
    1 3 20 30
    2 1 50 50
    3 3 10 30
    4 2 10 10



    My problem here is that the running balance didn’t work anymore. I’d like to display a running balance per customer like:
    TransID CustomerID Amount Balance
    1 3 20 20
    2 1 50 50
    3 3 10 30
    4 2 10 10

    Does anyone perhaps know how I can somehow manage to make it work? I read that multiple DSUM criteria would do but I get an error when I use Balance: DSum(“[Amount]”, “[Transactionstbl]”, “[TransID]<=‘“ & [TransID] & “‘ AND “[CustomerID]=“ & [CustomerID])
    Last edited by justdone; 10-08-2020 at 01:28 AM. Reason: Typo

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 10 Access 2016
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Have you tried/considered using a report
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Too many quotes. Try

    DSum(“[Amount]”, “[Transactionstbl]”, “[TransID]<=“ & [TransID] & “ AND [CustomerID]=“ & [CustomerID])
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  4. #4
    justdone is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Sep 2020
    Posts
    5
    Update: It worked just how I needed it to. Thank you for your help. It is very much appreciated

Please reply to this thread with any new information or opinions.

Similar Threads

  1. DSum meeting multiple criteria
    By smatchymo in forum Access
    Replies: 4
    Last Post: 06-29-2019, 03:52 PM
  2. Help! Stuck on DSUM with multiple criteria...
    By tbraswell in forum Access
    Replies: 2
    Last Post: 01-03-2019, 10:13 AM
  3. DSUM with multiple criteria
    By Bkper087 in forum Access
    Replies: 4
    Last Post: 02-13-2017, 10:19 PM
  4. Value from DSUM with multiple criteria wrong
    By maxmaggot in forum Reports
    Replies: 4
    Last Post: 04-12-2014, 05:21 PM
  5. How to use a create a DSum with multiple criteria
    By FlyingDisc in forum Reports
    Replies: 1
    Last Post: 01-05-2011, 08:31 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