Results 1 to 3 of 3
  1. #1
    Nanuaraq is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Mar 2017
    Posts
    77

    Why does query show empty records despite a search criterion for "Is not null"?

    I have a table, in which one column is named "ProducerID".
    In some records (rows), there is content in ProducerID, in other records, ProducerID is empty.
    I am trying to do a query where only those records with content in ProducerID is shown.
    This should be simple: I open a query in design view, and I populate the query with the columns I wish to be shown, and then I apply the criteria "Is not null" below ProducerID.



    The query return a lot of records with content in ProducerID. This is expected.
    Strangely, the query also returns quite a lot of records with no content in ProducerID. This I don't understand.

    I can see the number of records returned is lower if I apply the criterion "Is not null" than if I don't apply the criterion. So, I must assume that the application of the criterion actually do manage to leave some records out, but apparently a lot of empty records seem to find their way into the query result anyway, despite the applied criterion.

    I have tried swapping "Is not null" for "Like "*"". Same result.

    Any suggestions for why the query shows records with no content in column ProducerID?

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    Is the field in table set to allow zero length (empty) string? If so, for some records the field is most likely not Null even though it appears to be.

    I never allow empty strings in fields. I always change this property in table.
    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
    Nanuaraq is offline Advanced Beginner
    Windows 7 32bit Access 2013 32bit
    Join Date
    Mar 2017
    Posts
    77
    Quote Originally Posted by June7 View Post
    Is the field in table set to allow zero length (empty) string? If so, for some records the field is most likely not Null even though it appears to be.

    I never allow empty strings in fields. I always change this property in table.
    Wow, I had no idea there could be a difference between "empty" and "null". I thought that was exactly the same thing. Apparently not.
    Access is only my view, I do not have the possibility to alter the table properties (wherever they are kept). I cannot alter it in access.

    I made a workaround by using the criterion
    Not like ""
    instead of IsNotNull. It works.

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

Similar Threads

  1. How to show BLANK (null) counts as ZERO "0"
    By KingOf206 in forum Queries
    Replies: 17
    Last Post: 07-25-2017, 03:52 PM
  2. Replies: 1
    Last Post: 03-16-2017, 12:29 PM
  3. Replies: 28
    Last Post: 05-24-2016, 02:11 PM
  4. Replies: 4
    Last Post: 01-22-2015, 10:30 AM
  5. Passing criteria "NULL" or "IS NOT NULL" to a query
    By SgtSaunders69 in forum Forms
    Replies: 1
    Last Post: 12-24-2011, 02: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