Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2021
    Posts
    13

    DSUM Error

    Hello,



    I searched this forum for an answer but didn't seem to find any posts that related to my problem. I've got a table named tblGeneralLedger. In that table, I've got a field that's a calculated field called GLBalance. I want to have a running sum or the GLBalance field. I've got another field in my table that's called RegAcctID which is the foreign key to the table called tblRegisterAccounts. I know I've probably missed something. Here is my DSUM expression that I used. RunningSum: DSum("GLBalance","tblGeneralLedger","RegAcctID") I keep getting an error message that says it can't find the "RegAcctID" field. What am I doing wrong?

    I'm sorry if my question isn't clear or if someone has already posted a similar post.

    Thanks for you help in advance!

    Joel

  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,540
    The third argument for DSum() requires a criteria expression. In a query sorted by RegAcctID, try something like:
    RunningSum: DSum("GLBalance","tblGeneralLedger","RegAcctID<" & RegAcctID)

    That said, I think you'd be better using a report rather than a query to get a running total.
    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
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Agree, textbox on report has RunningSum property.

    Also, domain aggregate functions can cause slow performance in query with large dataset.

    Can be done with a correlated subquery but not sure performance would be faster.
    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 error in query
    By Mubashir in forum Queries
    Replies: 3
    Last Post: 02-11-2017, 09:36 AM
  2. Should be simple DSUM - I get #error
    By crimedog in forum Access
    Replies: 3
    Last Post: 10-28-2015, 08:58 AM
  3. Dsum, Syntax error
    By mike02 in forum Queries
    Replies: 5
    Last Post: 05-24-2013, 09:52 AM
  4. DSum Error
    By alsoto in forum Queries
    Replies: 4
    Last Post: 11-21-2011, 10:47 AM
  5. DSUM() Error
    By msr71 in forum Access
    Replies: 14
    Last Post: 09-25-2011, 06:39 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