Results 1 to 4 of 4
  1. #1
    willkr is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2023
    Posts
    110

    Query with blank value won't compute

    I have a query that looks like this:


    =Nz(DSum("[SavingsDepBal]","qrySavingsDepositGrandTotal"),0)-Nz(DSum("[SavingsWithdrawTot]","qrySavingsWithdrawalGrandTotal"),0)
    It works fine as long as the SavingsDepBal 0r SavingsWithdrawTot are not blank. What do I have to do to make this work with a blank field (field = "")?

    willkr

  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,929
    That is not a query, it is expression in textbox.

    What happens?

    "" is an empty string and not the same as Null. A number field cannot have empty string. If these fields are result of a calculation, why would they be empty string?

    If field is Null, DSum should return Null.
    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
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,940
    Why would they be blank and not 0?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    It works fine as long as the SavingsDepBal 0r SavingsWithdrawTot are not blank. What do I have to do to make this work with a blank field (field = "")?
    just to clarify - what/which fields? The ones you are trying to sum?

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

Similar Threads

  1. How to compute a running total in Access?
    By gdougher in forum Access
    Replies: 1
    Last Post: 10-29-2019, 01:34 PM
  2. Replies: 1
    Last Post: 05-11-2015, 07:05 PM
  3. Replies: 7
    Last Post: 04-29-2012, 02:06 PM
  4. Replies: 6
    Last Post: 07-23-2011, 12:35 PM
  5. How To Compute Percentages
    By zephaneas in forum Queries
    Replies: 7
    Last Post: 06-20-2011, 12:40 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