Results 1 to 6 of 6
  1. #1
    janelgirl is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    16

    Question Query not returning null values


    2007 version - my child query is not returning null values. I have 2 fields, both pulled from a parent query. One is "DaysSinceRecd", the other is "AmountPaying". The parent query returns multiple results, which is fine. For example, the parent query might have 10 different records for "0" "DaysSinceRecd", with different "AmountPaying" for each of those records. In the child query, I am trying to condense that down, so that I only have one "AmountPaying" for each "DaysSinceRecd". It's working fabulously, except that there are records in the parent query that have a value for "AmountPaying" but a null value for "DaysSinceRecd". The null value for "DaysSinceRecd" cannot be changed to another value, it needs to stay null. My child query is not returning the null records. I tried adding to the criteria: IsNull Or IsNotNull, >=0 or <=0. That's not working. I'm a novice, so speak slowly, please . TIA for any help that you can provide.

  2. #2
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    or you can use the Is Null criteria in an"Or" statement, or you can use the Nz function.

    syntax: Nz(variable,value if null), for instance Nz([MyField],0) will return 0 everywhere the field [MyField] is empty.

    greetings
    NG

  3. #3
    janelgirl is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    16
    I tried the "Or" statement, no luck there. Is there a way to use the Nz function that would return the null fields as null? I need it to stay null if possible. Thanks!

  4. #4
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    the point of the Nz function is to eliminate empty values.
    With the "OR" statement I meant, if you have other criteria you can combine them with an or criteria as:

    select fieldA, fieldB, fieldC from tblMyTable where fieldC > 0 OR fieldC Is Null

    greetings
    NG

  5. #5
    janelgirl is offline Novice
    Windows XP Access 2007
    Join Date
    Mar 2011
    Posts
    16
    That isn't working either. The query still does not return the null values. Any other ideas?

    TIA!

  6. #6
    NoellaG's Avatar
    NoellaG is offline VIP
    Windows 7 Access 2010 (version 14.0)
    Join Date
    Jun 2010
    Location
    Belgium
    Posts
    1,044
    Hi,

    not without seeing the query. Can you post the SQL of both queries, or better yet post an example access file with some data and both queries?

    gr
    NG

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

Similar Threads

  1. Query with null values
    By Psyclone in forum Queries
    Replies: 3
    Last Post: 03-30-2011, 09:57 PM
  2. null values
    By ippy in forum Queries
    Replies: 3
    Last Post: 12-20-2010, 10:39 AM
  3. Excluding null values on SQL table query
    By DB2010MN26 in forum Queries
    Replies: 1
    Last Post: 09-03-2010, 12:54 PM
  4. Null Values in query
    By LesleaOH in forum Queries
    Replies: 0
    Last Post: 10-19-2009, 04:45 PM
  5. Null Values not showing up in a Query
    By Valli in forum Queries
    Replies: 0
    Last Post: 01-04-2006, 03:53 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