Results 1 to 3 of 3
  1. #1
    skidawgs is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2019
    Posts
    26

    Question Query Criteria to Allow Null Values, or One Specific Value If Not Null

    Hi,

    I am trying to write a where statement for my query which will accept all null values for a specific column, as well as any record where the value is "current" in that same column.

    Essentially, I assumed that adding the following code to my Sidebar.Form.Filter would allow all null values, and prevent the value from being "Past": strFilter = strFilter & "[Status] <> 'Past' AND "
    P.S. I do remove the ' AND ' at the end of my string when compiling the Filter, and have everything in regards to the filter working besides this one part.


    This does prevent any 'Past' Status value records from appearing, however it also removes all null status values from the query.

    My table structure may help explain some of this:
    I have a Candidate Table, a Position Table, and a Candidate_Position Join table between the two because of the m-m relationship. I want the filter to prevent the query from displaying any 'Past' Candidates, however when I implement the above code it also removes all positions that don't have an associated candidate (which is not what I am looking for). I have to add the filter via this vba format in order to keep and build upon the desired functionality.

    Any advice would be greatly appreciated, I have been stuck on this for a little bit with no success thus far.

    Thank you,
    Skid

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    really need to see some example data and the desired outcome from that data but guessing at the requirement you probably want something like

    "[Status] <> 'Past' OR [Status] is null"

  3. #3
    skidawgs is offline Novice
    Windows 10 Access 2016
    Join Date
    Aug 2019
    Posts
    26
    Hi Ajax, thanks for the prompt reply.
    That is actually just what I was looking for. Somehow this slipped entirely past me. Anyways, thanks for your help!

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

Similar Threads

  1. Replies: 4
    Last Post: 04-09-2019, 02:05 PM
  2. Query Criteria not including null values
    By shaun_za in forum Queries
    Replies: 1
    Last Post: 09-09-2015, 07:01 AM
  3. Query criteria with values and null
    By robsworld78 in forum Queries
    Replies: 13
    Last Post: 03-27-2012, 05:44 AM
  4. Replies: 1
    Last Post: 02-23-2012, 02:27 PM
  5. Finding the Max Date and Null Values if Null
    By SpdRacerX in forum Queries
    Replies: 1
    Last Post: 02-03-2012, 06:29 AM

Tags for this Thread

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