Results 1 to 6 of 6
  1. #1
    David Lovegrove is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Feb 2019
    Posts
    2

    Mystifying QBE Problem

    I am not a developer – perhaps I qualify as a “power user”. I am developing a simple contact management database using Access within Office 365. All the fields are short text fields. They comprise name, contact information, a comment field and some fields that I use to hold codes. One of the latter, “Comms”, is currently either blank or contains “PA” or “EMF” – the latter indicates that although I have an email address, it has failed. I do not have an email address for 6 people.



    The first thing that I want to do with my database is to send out an email about a new event that I am planning.

    So I develop a query, using the QBE mechanism, that selects records that have an email address. I can use “Is not Null” or “Like *@*” for the email field. Both work correctly.

    Then I want to weed out records that have “EMF” in the “Comms” field. So I add a column to the query:-

    “Comms” <> EMF or Is Null (for some reason if I do not use “Is Null” I do not get records where “Comms” is blank – however this not the issue that I want to raise)

    When I run the query, records with the EMF code are omitted but I get records where there is no email address !

    Can anyone explain and put me right please.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,743
    Please post the SQL of the query involved.

  3. #3
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,992
    If you need both filters they should be on the same row in the filter criteria so its filtering on one AND the other.
    I suspect you have them on different rows which filters for one OR the other.
    If you change to SQL view, you can see what is going on
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,446
    simply, your query is not written correctly. Hard to say without seeing the actual sql generated by the query builder - but suspect you are mixing up your and's and or's

  5. #5
    David Lovegrove is offline Novice
    Windows 7 64bit Access 2016
    Join Date
    Feb 2019
    Posts
    2

    Thumbs up Thank you - Problem Solved

    Quote Originally Posted by isladogs View Post
    If you need both filters they should be on the same row in the filter criteria so its filtering on one AND the other.
    I suspect you have them on different rows which filters for one OR the other.
    If you change to SQL view, you can see what is going on
    Thank you - you are spot on. Problem solved. This was the first time I had used QBE with slightly more complex filtering.

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,992
    You're welcome.
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

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

Similar Threads

  1. Replies: 9
    Last Post: 07-06-2015, 01:47 AM
  2. Replies: 2
    Last Post: 10-31-2012, 11:52 AM
  3. Replies: 2
    Last Post: 06-14-2010, 03:25 PM
  4. query problem i have a problem wi
    By maxx3 in forum Queries
    Replies: 0
    Last Post: 06-29-2009, 02:29 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