Results 1 to 5 of 5
  1. #1
    bcarter17 is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jun 2021
    Location
    Richmond MO
    Posts
    35

    Null Query Results

    Hello everyone,
    I have what should be a simple one. It is more cosmetic than anything else but some users have brought it up. On a form we use, I have a button that opens an "Update" form, to show the user how many total loads, and how many tons of material have shipped on the current day.

    But, until we get the first load of the day, the query seems to be able to count up the number of loads (none) and report a 0 back, but for the sum of tons, it shows blank.

    I have tried several different possibilties of use NZ, DCount, IIF, etc. with no luck.


    Click image for larger version. 

Name:	1.jpg 
Views:	19 
Size:	17.2 KB 
ID:	51365Click image for larger version. 

Name:	2.jpg 
Views:	19 
Size:	18.7 KB 
ID:	51366Click image for larger version. 

Name:	3.jpg 
Views:	19 
Size:	48.7 KB 
ID:	51367

    All help appreciated.

  2. #2
    xps35's Avatar
    xps35 is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Jun 2022
    Location
    Schiedam, NL
    Posts
    232
    I don't know what exactly you tried, but this one works for me:
    Code:
    SELECT Count(Sales.TicketNumb) AS Loads, nz(Sum(Sales.NetTons),0) AS Tons
    FROM Sales
    WHERE Sales.SalesDate=Date() And Void = False;
    Last edited by xps35; 01-24-2024 at 09:40 AM.
    Groeten,

    Peter

  3. #3
    bcarter17 is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jun 2021
    Location
    Richmond MO
    Posts
    35
    Thank you Peter! We're wrapping up the day here, so i will give that a try in the morning. Thanks for the response!

  4. #4
    bcarter17 is offline Advanced Beginner
    Windows 10 Access 2007
    Join Date
    Jun 2021
    Location
    Richmond MO
    Posts
    35
    Just set this up and it works on my end as well, thanks Peter! Appreciate the advice on this.

  5. #5
    Join Date
    Apr 2017
    Posts
    1,680
    Btw., Some value + Null = Null (Null isn't same as 0, it means that there is no value). This explains why you got nothing when summarizing! And Nz() in Peter's example replaces Null value with 0 - i.e. with a real number.

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

Similar Threads

  1. Return value for NULL query results
    By shank in forum Queries
    Replies: 3
    Last Post: 02-25-2020, 01:23 PM
  2. How to get a query to return results for null/0 value?
    By NikoTheBowHunter in forum Queries
    Replies: 8
    Last Post: 08-28-2018, 09:04 AM
  3. Query Results with Null Value
    By Ramtrap in forum Queries
    Replies: 3
    Last Post: 12-28-2016, 11:44 AM
  4. Replies: 4
    Last Post: 10-13-2015, 02:29 PM
  5. Blank form on null query results
    By JackieEVSC in forum Forms
    Replies: 11
    Last Post: 11-30-2011, 08:39 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