Results 1 to 7 of 7
  1. #1
    utellem is offline Novice
    Windows 7 64bit Access 2002
    Join Date
    Nov 2013
    Posts
    3

    Query Help

    I am creating a filter button with the following query...

    Form_MemberHeading.Filter = "[Active] = -1 AND [Title] <> 'Missionary'"



    I want to find all records where the ACTIVE is TRUE and the TITLE is not equal to the phrase MISSIONARY.
    The button works except it also excludes the records where the TITLE is blank. How can I fix this?

    Many thanks

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,627
    Try:

    Form_MemberHeading.Filter = "[Active] = -1 AND [Title] <> 'Missionary' AND Not IsNull([Title])"

    or

    Form_MemberHeading.Filter = "[Active] = -1 AND [Title] <> 'Missionary' AND Not [Title] 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.

  3. #3
    utellem is offline Novice
    Windows 7 64bit Access 2002
    Join Date
    Nov 2013
    Posts
    3
    Thank you for the effort. I tried them both but I got the same results with both. All three lines pulled out the records with various titles but no records which had that field blank. Anymore ideas? Again, thank you.

  4. #4
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    Form_MemberHeading.Filter = "([Active] = -1) AND ([Title] & '' <> 'Missionary')"

    June - you forgot the parens around the title tests, should be OR null.

  5. #5
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,627
    Dal, why the & and extra "? Fix it and just puts OP back where they started.

    But you are right about the parens and OR. I just had to read OP more carefully. I think Is Null is the correct syntax.

    Form_MemberHeading.Filter = "[Active] = -1 AND ([Title] <> 'Missionary' Or [Title] 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.

  6. #6
    utellem is offline Novice
    Windows 7 64bit Access 2002
    Join Date
    Nov 2013
    Posts
    3
    PERFECT!!! Many thank yous.

  7. #7
    Dal Jeanis is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2013
    Location
    Dallas TX
    Posts
    1,742
    June -

    That's two single-quotes, so it's a zero-length string, and concatenated with Null it's still the empty string. I've often seen that done as a cheap way to eliminate Nulls. (Usually I use two double-quotes, but in situ single quotes were required.)

    Since "Null & ''" is the empty string and is not equal to 'Missionary', that also merged the two tests into a single condition.

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

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