Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    StampMan is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Perth, Western Australia
    Posts
    24

    How Do I Make A Blank Field In A Report Show A Value of " 0 " So That Report Calculates?

    Hi,
    How can I make a blank field in a report show a value of Zero " 0 ", if there is no record for that field. My reports will not calculate otherwise. I thought that maybe I could achieve this through conditional formatting but I fail to see how.


    Any help appreciated.

  2. #2
    A S MANN is offline Advanced System Analyst
    Windows XP Access 2007
    Join Date
    Oct 2010
    Location
    India
    Posts
    161
    In the controlsourse propert of empty field use
    =IIF(IsNull([Field_Name]),"0"," ')
    This will show 0 if field is null.

  3. #3
    StampMan is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Perth, Western Australia
    Posts
    24
    Thank you, are you sure though that it has =IIF at the beginning and not =IF ?

  4. #4
    StampMan is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Perth, Western Australia
    Posts
    24
    The control source for the field is used (by query) so what now?

    It's almost like I need to set the default value for the field as " 0 " but this option is not available in properties..............

    This is what's in the control source already "Sum Of CWUSTotQty" which is a query. If the table that the query is working from has no records yet, then the report shows a blank for that field on the report. This is turn stops the report from completing the calculation because I'm guessing it doesn't know what to do with the blank field. Which is why I need it to display " 0 "

    So how exactly should the control source look?

    Sum Of CWUSTotQty (and then an expression here)?

  5. #5
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    Are you using a query or table for the report?

    Not recommended. If you are using a table, then you should be able to change the default value in the table design. Then you need to update all NULL value in that field to 0.

    Recommended. If you are using a query, then you should be able use the "IIF" or "NZ" or others to convert the field to 0 if it is NULL.

  6. #6
    StampMan is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Perth, Western Australia
    Posts
    24
    The field in the report gains it's information from a query.
    The query is Sum Of CWUSTotQty, so if Sum Of CWUSTotQty is already in the control source, where do I put the "IIF" or "Nz" ?
    All tables (that the query looks at) have default value of 0 anyway.
    Getting frustrated! lol

    Keep in mind, there is no record for this field yet, and may not be for a while, which is why I need it to report " 0 " so rest of report works.

    Click image for larger version. 

Name:	Control Source.png 
Views:	10 
Size:	30.2 KB 
ID:	19689

    If I create a dummy record, the report totally works even if the value is 0. I don't want to have a dummy record just to get the report to work.

  7. #7
    StampMan is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Perth, Western Australia
    Posts
    24

    Urgent help needed Please..............

    Please see my original post in the reports section

    MOD EDIT: Threads merged.
    Last edited by June7; 02-12-2015 at 02:06 PM.

  8. #8
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    I would suggest using the NZ() function in your query.
    More on NZ syntax and examples

    Select...... Nz(yourCalculatedField,0) from yourTable.....

    More on calculated fields and reports here

  9. #9
    StampMan is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Perth, Western Australia
    Posts
    24
    Thanks Orange,
    But where exactly is the Nz function supposed to go? Table or query? In which property?

  10. #10
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    I would put it in the Query you are using as the recordsource. Can you post the associated sql for that query?

  11. #11
    StampMan is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Perth, Western Australia
    Posts
    24
    I really appreciate your help on this Orange.
    I don't believe I've done anything sql related.............
    The query looks at another query if that makes sense. So what would you need to look at?

  12. #12
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    Did you look at the NZ() syntax and examples?

    What you are looking for in my view, is a means to show a 0 if the fields is empty (null).
    That is the purpose of NZ. So you would include -modify the query- an NZ(yourFieldThatMayBeNull,0).

    This is the same info that was suggested in Post2 any many others in your other thread????

    You seem extremely hesitant to use the info you have been given.

    Let me lead you through a small scenario:

    You design and build a Table or several tables.
    You create a query using some of these tables.
    You design and build a report based on the Query.
    You want to test the Report, but there's no data in any table, so there is no data for the query, so there is no data for the report.
    If part of your query is to add some field values together, and there are no values, there's nothing there, yet.
    You can't add nothing (null) to nothing(null)..

    When you design anything, you have some test data (good and bad values) and some scenarios. You test the scenarios against your design plan(data model) and resolve/reconcile all anomalies before you build the "production" database.

    Here's another example, trying to parallel the steps above:

    You have some land. You design some infrastructure and streets.
    You then build and finish some houses. But the houses are unoccupied.
    Someone requests a report from you --What is the sum of the ages of the occupants?

    There are no occupants, so there are no ages, and there is no Sum?

    You need data in your tables; and occupants in the houses; to do arithmetic.

    The use of NZ() is just allowing a 0 to be displayed when there is nothing/null/empty/noValue/unknown in the field.

  13. #13
    StampMan is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Perth, Western Australia
    Posts
    24
    I appreciate that, but no one has told me in clear terms exactly where that NZ should be placed?
    One person suggested to put it in the control source, but the control source has the query name in it.
    I need to know exactly what part of the query I put it into, how it should look etc.
    Sorry, but I'm a newbie at this...........

  14. #14
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,722
    If you have a table with a numeric field that has not yet been populated.

    Create this query: NOTE: This is READONLY and will not affect any data

    Select Sum(YourNumericFieldHere) From YourTableHere

    Place this query in the sql view of the query wizard. Run the query and tell us what happens/results.

  15. #15
    StampMan is offline Novice
    Windows 8 Access 2013
    Join Date
    Oct 2014
    Location
    Perth, Western Australia
    Posts
    24
    I really am grateful for your assistance, but it's easier just to create a false record for that table with both a qty and cost of " 0 " so that the report fields populate and the rest of the report now functions truly. I can just overwrite the dummy record with true figures once that type of used product comes in.

    Sorry, but I thought there would be an easy fix for this.
    Thank you for trying :-)

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

Similar Threads

  1. Replies: 4
    Last Post: 02-06-2015, 03:58 AM
  2. Replies: 1
    Last Post: 01-05-2013, 10:46 PM
  3. Export "Query or Report" to a "Delimited Text File"
    By hawzmolly in forum Import/Export Data
    Replies: 3
    Last Post: 08-31-2012, 08:00 AM
  4. Replies: 1
    Last Post: 08-23-2012, 08:32 AM
  5. How to make Report omitting "Done" jobs?
    By SHogan in forum Reports
    Replies: 6
    Last Post: 02-24-2012, 06:57 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