Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    lenlab is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    24

    Report field shows Blanks and would like to show 0

    I have a report that when the following is processed and there is no number (values) it shows blank in the report field and I would like to show 0 instead. Is there something I can change in this formula to make it happen?



    =DSum("[Sum of Giv Amt]","New Giving Query Jul")+DSum("[Jul Misc Income Total]","Sunday Audit")

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    try
    =Nz(DSum("[Sum of Giv Amt]","New Giving Query Jul")+DSum("[Jul Misc Income Total]","Sunday Audit"),0)
    If that doesn't work, state where that expression is located (e.g. report textbox, query).
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    lenlab is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    24
    Yes it worked! Thanks so much for the help!

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    Or use the control format property. Away from my computer right now but pretty sure it will be

    ,,,0

    For numbers there are 4 states separated by a comma

    Positive, negative, zero, null

  5. #5
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    You're welcome. Glad we could help.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  6. #6
    lenlab is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    24
    Ajax your suggestion is interesting but it is over my head. Sorry I did not follow what I was supposed to try and where. Was I supposed to change something in the property sheet for this field?

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,858
    Put in the format property of the control.
    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

  8. #8
    lenlab is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    24
    Welshgasman,

    I tried it and entered ,,,0 and it converted it to ",,,"0 and it did not do anything as far as showing "0" in the report for that field.

  9. #9
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,397
    Try semi colons rather than commas

  10. #10
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    The separators depend on your regional settings
    Try ;;;0 instead in the format property

    EDIT: Snap!
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  11. #11
    lenlab is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    24
    the ;;;0 does put 0 in the field but if there is a value from the expression it is lost and the zero overides the value brought in from the query. I would like it to only show zero when the query has no data to display.

    So the expression Micron gave me works better for me:=Nz(DSum("[Sum of Giv Amt]","New Giving Query Jul")+DSum("[Jul Misc Income Total]","Sunday Audit"),0)

  12. #12
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    Quote Originally Posted by lenlab View Post
    the ;;;0 does put 0 in the field but if there is a value from the expression it is lost and the zero overides the value brought in from the query. I would like it to only show zero when the query has no data to display.
    Sorry about that.
    If you are still interested, this format DOES exactly what you wanted: #;;;0
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  13. #13
    lenlab is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    24
    isladogs,

    Yes this seems to work. The field is now showing value when it is present and 0 when it is not. The only issue is it should display a value with a $ sign and now that is lost. Is there a fix for that? Okay I put the $ in front of the # sign and that did the trick! The other issue that I just noticed is if the value that displayed as $1,000 before it now displays as $1000 without the comma separator for thousands. Is that fixable?

  14. #14
    orange's Avatar
    orange is offline Moderator
    Windows 10 Office 365
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

  15. #15
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Office 365
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,954
    You didn't mention anything about currency before!
    You can easily restore the comma by using Standard or Currency on the Format property. However doing that will remove the 0 where there is no data.
    To have both, you will need to create your own format. See Number and Currency data types (Format property) | Microsoft Docs

    EDIT: Yet again SNAP! Same link as given by @orange
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Output report shows scrambled data in a field
    By BenHPieters in forum Reports
    Replies: 4
    Last Post: 01-21-2022, 10:58 PM
  2. Show Blanks in count as 0
    By WickidWe in forum Queries
    Replies: 2
    Last Post: 12-11-2013, 01:37 PM
  3. Replies: 12
    Last Post: 10-21-2013, 07:46 AM
  4. Replies: 6
    Last Post: 07-10-2013, 07:39 AM
  5. Access filter does not show blanks
    By Jaricketts in forum Access
    Replies: 1
    Last Post: 03-26-2010, 05:38 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