Results 1 to 14 of 14
  1. #1
    Russellh is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    68

    How to query for recors where filed 1 = a or b or c OR if field 2= a, b , c OR field 3...

    I need to pull all records where either FIELD 1, FIELD 2, or Field 3 have a value of 60, or 61, or 63.

    In design view I can do it for 1 field by just adding 60,61,63 in the OR sections underneath the field. But how do I add the others?

  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,652
    Sounds like a normalization issue, but put this in the criteria, on a different line for each field (creating an OR):

    In(60, 61, 63)
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Russellh is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    68
    I get the expression is too complex error when I try to run it with In(60, 61, 63)Click image for larger version. 

Name:	access 16.2.29 a.jpg 
Views:	10 
Size:	157.4 KB 
ID:	23901

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    As Paul said, put the In(60, 61, 63) on different rows to create an OR condition.

    Your graphic shows these criteria all on the same row--which is not what Paul said.

  5. #5
    Russellh is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    68
    Quote Originally Posted by orange View Post
    As Paul said, put the In(60, 61, 63) on different rows to create an OR condition.

    Your graphic shows these criteria all on the same row--which is not what Paul said.
    I get the same error when I do it like this. Click image for larger version. 

Name:	access 16.2.29 b.jpg 
Views:	10 
Size:	138.9 KB 
ID:	23903

  6. #6
    orange's Avatar
    orange is offline Moderator
    Windows 8 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    Well, Paul's first thought was you may have a Normalization issue. It seems that is true.
    Two tables, no PK evident. No supporting info.

    I think you'll have to tell us a lot more about your business in plain English and where this database fits. Until readers understand what you are dealing with, and what your data base is about, the best we can do is throw out a generic response to your generic question.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    If the fields are text, you'd need to wrap each number in quotes. Make sure problem isn't on the other criteria, which would have to be repeated.

    And you certainly have a normalization problem:

    Fundamentals of Relational Database Design -- r937.com
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    Russellh is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    68
    Quote Originally Posted by pbaldy View Post
    If the fields are text, you'd need to wrap each number in quotes. Make sure problem isn't on the other criteria, which would have to be repeated.

    And you certainly have a normalization problem:

    Fundamentals of Relational Database Design -- r937.com
    Fields are txt. When I added the quotes it seems to only pull records that have the wanted codes in the Reoccur2 Code field and not the others.
    This Database is created by a Software Company that provides us with our Customer Information System. They allowed us to install and ODBC connection and read the tables (no modification) to build our own custom reports.
    They are not going to change the format of the database just for myself.

    Any other ideas?

  9. #9
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Did you copy the criteria in the far right column down as suggested?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    Russellh is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    68
    Correction... IT WORKS with the Quotes. The remaining issue was with my last column. There was a typo there. Should have been greater than and then less than. I had em backwards. THANKS FOR THE HELP GUYS AS ALWAYS!!!
    Attached Thumbnails Attached Thumbnails access 16.2.29 c.jpg  

  11. #11
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,441
    try a criteria of

    '60' or '61' or '63'

    in each of your REOCCURCODE fields

    Also, as others have said, make sure you copy the criteria in your BILLMOYR field down to the 2nd and 3rd rows as well.

  12. #12
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Test a little and I suspect you'll find that records that meet the In() criteria in the _2 and _3 fields aren't necessarily meeting the criteria in that far right field.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  13. #13
    Russellh is offline Advanced Beginner
    Windows 8 Access 2010 32bit
    Join Date
    Apr 2014
    Posts
    68
    Quote Originally Posted by rpeare View Post
    try a criteria of

    '60' or '61' or '63'

    in each of your REOCCURCODE fields

    Also, as others have said, make sure you copy the criteria in your BILLMOYR field down to the 2nd and 3rd rows as well.
    If I move it down will I not have to type in 6 dates?

  14. #14
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    Have you tried?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 3
    Last Post: 09-16-2014, 01:45 PM
  2. Replies: 2
    Last Post: 10-21-2013, 03:50 PM
  3. Sum numerical filed based on other field
    By BorisGomel in forum Access
    Replies: 0
    Last Post: 07-11-2012, 09:54 AM
  4. Replies: 1
    Last Post: 10-10-2010, 05:30 AM
  5. Replies: 0
    Last Post: 03-16-2006, 04:59 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