Results 1 to 7 of 7
  1. #1
    Andrea is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Mar 2011
    Posts
    6

    Query Expressions

    I am new to Access and trying to create a query that does the following: I have 4 fields for different phone numbers (home phone, work phone, etc) and a field for email addresses. Some phone numbers are empty and I want to show a list of my contacts who have email address but no phone numbers. Help!

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    In SQL view, it would look like:

    WHERE EmailAddress Is Not Null AND HomePhone Is Null AND WorkPhone Is Null AND...

    In design view, Is Not Null on the email field and Is Null on the phone fields, all on the same line.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Andrea is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Mar 2011
    Posts
    6
    wow, its that simple? i was playing around with the nulls but i was making it too complicated - using parenthesis and such. you're awesome! thanks!

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    It's that simple if it works.

    Welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Andrea is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Mar 2011
    Posts
    6

    a little trickier

    One more question please??!!?!?
    I want to display those who have email addresses and no cell phone listed but another number is listed. I have 3 other phone number fields: home phone, work phone, etc. and as long as there is a number in one or more of those - i want to display. just eliminating the ones who do not have any phone numbers listed. So I put "Is Null" in the cell phone field, "Is Not Null" in the Email field. What do I put in the other 3 phone fields?

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,640
    Try

    WHERE EmailAddress Is Not Null AND CellPhone Is Null AND (HomePhone Is Not Null OR WorkPhone Is Not Null OR WhateverPhone Is Not Null)

    Note the parentheses, which when mixing AND & OR become important to clarify the logic. It's much simpler to do in SQL view to me, but it can be done in design view.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Andrea is offline Novice
    Windows Vista Access 2010 64bit
    Join Date
    Mar 2011
    Posts
    6
    awesome! worked like a charm. i guess it is better to learn sql than design sometimes. you really helped me out. thank you! im just learning access - it is a really great program!

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

Similar Threads

  1. Replies: 3
    Last Post: 08-04-2010, 09:35 AM
  2. Multiple Count Ifs and Expressions in Query
    By jonrockwell08 in forum Queries
    Replies: 1
    Last Post: 07-21-2010, 10:44 AM
  3. Nested If Expressions
    By Lynn in forum Forms
    Replies: 5
    Last Post: 03-25-2010, 10:11 AM
  4. Combining Two DCount expressions in one
    By nmodhi in forum Forms
    Replies: 1
    Last Post: 02-26-2010, 10:49 AM
  5. Conditions / Expressions
    By Mark344 in forum Access
    Replies: 1
    Last Post: 02-19-2010, 08:15 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