Results 1 to 7 of 7
  1. #1
    RLJ is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    9

    Query a numer field for 2 values

    I have a number field that I have set to the Field size of "Integer". I need a criteria to show a -1 and an Is Null. So I want both of these values to show in the query. I have tried in the Criteria box of the Query builder -1 And Is Null and it returns no records.



    Thanks for your help.

  2. #2
    rzw0wr is offline I will always be a newbie
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Indiana
    Posts
    479
    Code:
    SELECT yourfields FROM YourTable WHERE YourFiled is null or Yourfield True;

    Dale

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Code:
    SELECT fld1, fld2, fldx
     FROM YourTable 
    WHERE YourField is NULL or Yourfield = -1;

    ...untested...

    Make sure you have data in the table to support your expectations( at least one NULL and one -1 value.

  4. #4
    RLJ is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    9
    I'm not sure either of these will work, since it is 1 field that I need to show values for both the -1 and Null Values. I have plenty of data in my table to support my expectations. I know how many records I should get returned.

  5. #5
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870

  6. #6
    RLJ is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    9
    Putting it like this:
    Criteria: -1
    or: Is Null

    This returns no records. The combination of the 2 should return 16 null records and 62 -1 records for a total of 78 records

  7. #7
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Can you post a zip of your database--- just enough data to show the issue. Please remove anything private/confidential before posting.

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

Similar Threads

  1. Query to show AVERAGE of all values in a field
    By taimysho0 in forum Queries
    Replies: 9
    Last Post: 01-09-2012, 11:18 AM
  2. Update Query selecting multiple values in one field
    By Zipster1967 in forum Queries
    Replies: 1
    Last Post: 08-15-2011, 12:22 PM
  3. IIf using other field values in same query
    By ErikaMarie0421 in forum Queries
    Replies: 2
    Last Post: 08-03-2010, 12:21 PM
  4. query field with multiple values
    By mknowles in forum Queries
    Replies: 1
    Last Post: 11-24-2009, 11:31 AM
  5. Query multiple values in a field
    By JAYgarti in forum Access
    Replies: 0
    Last Post: 07-09-2009, 09:52 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