Results 1 to 7 of 7
  1. #1
    dougdrex is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    49

    DSum function not returning any results

    Using Microsoft Access 2010.

    I'm using the Expression Builder to create a query. It is supposed to calculate the transfers in and transfers out of each account. The bank account is the first field, and the second field is TransfersIn. Following is the syntax from that field: TransfersIn: CCur(Nz(DSum("TransferAmount","TBL_TransactionDeta ils"),0)).



    Below is a screen shot if that will help with any feedback on what I am doing wrong.

    Click image for larger version. 

Name:	ErrorMsg.JPG 
Views:	13 
Size:	60.1 KB 
ID:	19106


    Thanks!
    Doug

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    The REF_BankAccounts table needs to be included in the query twice so there are two copies of the table in the query. Join one of each copy to FromAccount and ToAccount.

    Why are you using DSum to summarize data of table that is in the query?

    Build an aggregate query or a report.
    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
    dougdrex is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    49
    I get another error message when I build an aggregate query. Below is my screen and error message that comes up:

    Click image for larger version. 

Name:	ErrorMsg.JPG 
Views:	13 
Size:	50.9 KB 
ID:	19107

    Click image for larger version. 

Name:	ErrorMsg2.JPG 
Views:	13 
Size:	25.3 KB 
ID:	19108

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,610
    Don't understand the need for the criteria. What happens if you take it out.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    dougdrex is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    49
    Bob, that was it. I removed the criteria and the query worked exactly as intended.

    Thanks a LOT!!

  6. #6
    dougdrex is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2014
    Posts
    49
    Okay, I may have jumped the gun a bit on my enthusiastic response to what I believed to be the resolution to my issue. After removing the criteria and attempting to finish the query I remembered there was a purpose behind the query.

    Because TBL_TransactionDetails houses the transfers, I need to calculate both the transfers IN as well as the transfers OUT. Consequently, I need a seperate field in the query for transfers IN and transfers OUT. In order to calculate that correctly, I need the criteria of when the ToAccount field matches the BankAccountID field, and conversely, when the FromAccount matches the BankAccountID field for the TransfersOut field I had not yet created when I originally submitted this question.

    Any thoughts on how best to handle that?

    Thanks!
    Doug

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Maybe you need to do two aggregate queries. One to summarize the amounts for the ToAccounts, one to summarize the amounts for the FromAccounts. Then join those two queries to master table of accounts.

    BTW, wonder if BeginningBalance field is appropriate. The starting balance for an account should be the first transaction entry.
    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 Function
    By LOIZOS in forum Forms
    Replies: 10
    Last Post: 03-20-2014, 10:05 AM
  2. DSum Function
    By azhar2006 in forum Forms
    Replies: 7
    Last Post: 12-08-2013, 05:07 PM
  3. Dsum() Function
    By rkalapura in forum Queries
    Replies: 2
    Last Post: 10-24-2012, 05:58 PM
  4. Dsum() function
    By rkalapura in forum Forms
    Replies: 3
    Last Post: 10-10-2012, 10:06 PM
  5. Query not returning all of the results
    By velvettiger in forum Queries
    Replies: 4
    Last Post: 03-11-2010, 06:56 AM

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