Results 1 to 3 of 3
  1. #1
    cbuechner is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jan 2021
    Posts
    60

    Dsum iif

    I have a ledger. The ledger contains lines, and when entering data, you indicate if its a debit or credit. I then run a query, that collects that data.



    Debit: IIf([Ledger]![Type]="Debit",[Ledger]![Amount],0)
    Credit: IIf([Ledger]![Type]="Credit",[Ledger]![Amount],0)
    I then want to run a running total. This is the first part.

    DebitRunningSum: DSum("[Debit]","[Query1]","[ID]<=" & [ID])
    This part works, however, I'm trying to use just one ledger. I only want it to sum if the company matches. Currently it sums everything, and I want to have different companies.

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Add whatever additional criteria you need in the DSum(), such as:

    & " AND [Company]=" & [CompanyID])

    Alternatively, build a report and use textbox RunningSum property along with Sorting & Grouping features.
    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.

  3. #3
    cbuechner is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jan 2021
    Posts
    60
    Works great. Im learning, but times like this makes me feel that much more to learn.

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

Similar Threads

  1. dsum
    By AlexBen in forum Access
    Replies: 5
    Last Post: 10-04-2021, 06:22 PM
  2. DSum
    By GuyfromDet in forum Access
    Replies: 1
    Last Post: 02-24-2017, 11:43 AM
  3. Dsum
    By doddiah in forum Access
    Replies: 5
    Last Post: 07-20-2015, 02:56 PM
  4. DSum
    By balajigade in forum Queries
    Replies: 1
    Last Post: 04-26-2015, 10:26 AM
  5. Dsum Help?
    By Ragin_roider in forum Queries
    Replies: 5
    Last Post: 03-19-2012, 03:10 PM

Tags for this Thread

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