Results 1 to 4 of 4
  1. #1
    SpongebobKP is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2015
    Posts
    2

    Null Values Still Showing Up

    OK, I'm kind of a novice so this may be a simple dilemma. The issue is that I had originally made one query to exclude Null values from one field, DELIVERABILITY_CODE:



    SELECT current_addresses.* INTO CHANGE_OF_ADDRESS
    FROM current_addresses
    WHERE (Nz(current_addresses.DELIVERABILITY_CODE,"")="");

    That went fine, and so I made another query to show a selection of possible values in another field, MOVE_TYPE:

    SELECT current_addresses.* INTO CHANGE_OF_ADDRESS
    FROM current_addresses
    WHERE (((current_addresses.MOVE_TYPE)="B")) OR (((current_addresses.MOVE_TYPE)="I"));

    That also went fine as well.

    However, I'm now trying to combine the WHERE conditional to show the MOVE_TYPE values ONLY when the DELIVERABILITY_CODE is Null. I can't seem to combine that in a way that excludes the Null values on the DELIVERABILITY_CODE. I've tried using:

    WHERE (Nz(current_addresses.DELIVERABILITY_CODE,"")="") AND (((current_addresses.MOVE_TYPE)="F")) OR (((current_addresses.MOVE_TYPE)="B")) OR (((current_addresses.MOVE_TYPE)="I"));

    and also

    WHERE (Nz(current_addresses.DELIVERABILITY_CODE,"")="") OR (((current_addresses.MOVE_TYPE)="F")) OR (((current_addresses.MOVE_TYPE)="B")) OR (((current_addresses.MOVE_TYPE)="I"));

    but to no avail. I'm not sure where I need to make changes to get what I'm looking for.

  2. #2
    CJ_London is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,927
    your nz function may be giving you the wrong result, try

    WHERE current_addresses.DELIVERABILITY_CODE is null AND current_addresses.MOVE_TYPE in ("F","B","I")

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Have to be very careful in mixing AND and OR operators. Parentheses are critical.


    Maybe only need:

    WHERE current_addresses.DELIVERABILITY_CODE IS NULL


    There are only 3 MOVE_TYPE values or you are interested in only those 3? Will MOVE_TYPE always have data or could there be Null? Do you want to exclude records where MOVE_TYPE Is Null?

    Maybe:

    WHERE current_addresses.DELIVERABILITY_CODE IS NULL AND NOT current_addresses.MOVE_TYPE IS NULL
    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.

  4. #4
    SpongebobKP is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Oct 2015
    Posts
    2
    That actually works perfectly with AND NOT. The (F,B,I) are the only values that will ever show up in MOVE_TYPE and the rest would be Null so this filters out all those I am looking for. Thanks!

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

Similar Threads

  1. Crosstab Query Showing Null Values
    By equestrian in forum Queries
    Replies: 2
    Last Post: 09-22-2015, 03:24 AM
  2. Replies: 7
    Last Post: 04-02-2015, 07:25 AM
  3. Replies: 3
    Last Post: 02-24-2012, 01:23 PM
  4. Finding the Max Date and Null Values if Null
    By SpdRacerX in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 06:29 AM
  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