Results 1 to 3 of 3
  1. #1
    JustAnElf is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2013
    Posts
    16

    Displaying a Null value

    Greetings one and all,

    I realize this should be an easy query, but for some reason I'm having trouble. If possible I would like to use the query expression builder to make the query.

    My goal is to display the total of all of the fruit in the second table even if it's value is null. For example

    If Tables 1 and 2 look like this....

    Table1


    ID Fruit
    1 Apple2 Orange
    3 Pear
    4 Lime
    5 Pineapple

    Table 2
    ID Fruit List
    1 Apple
    2 Apple
    3 Apple
    4 Orange
    5 Orange
    6 Lime

    .... I want the query output to look like this

    Apple 3
    Orange 2
    Pear 0
    Lime 1
    Pineapple 0

    I can easily get make the query display the correct values for the Apple, Orange, and Lime. However, it's not working for the Pear, or Pineapple.

    Any suggestions?

  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,626
    Build a query that joins table 1 to the aggregate query, join type will be "Include all records from table1 and only those from table2 that match". Records for Pear and Pineapple should display with empty fields. Handle the null with calculation using Nz().

    Nz([SumOfFruit],0)
    Last edited by June7; 01-08-2014 at 11:07 PM.
    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
    JustAnElf is offline Novice
    Windows 7 64bit Access 2013
    Join Date
    Oct 2013
    Posts
    16
    Hi June7,

    Thank you for the advice. I knew it was something simple. Sadly, I had forgotten the part about the join. Your comment about "Include all records from table1 and only those from table2 that match" put me on the right path.

    Thank you!

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

Similar Threads

  1. Displaying data if potentially null
    By mpreston14 in forum Queries
    Replies: 5
    Last Post: 10-07-2013, 10:44 AM
  2. Only displaying non-null fields in query??
    By skier4life in forum Queries
    Replies: 1
    Last Post: 06-24-2013, 08:53 AM
  3. Replies: 1
    Last Post: 02-23-2012, 02:27 PM
  4. Displaying Count if Null value exists
    By adams.bria in forum Queries
    Replies: 3
    Last Post: 08-31-2011, 11:56 AM
  5. Displaying a null value as 0
    By jordanturner in forum Access
    Replies: 2
    Last Post: 09-17-2010, 09:22 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