Results 1 to 13 of 13
  1. #1
    kdtrimble is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2015
    Posts
    41

    Query - Filtering using multiple zip codes.

    I need to run a query that reports all sales from a list of 83 zip codes. I have not found out how to do this other than TEXT FILTERS - CONTAINS and then type each zip code in parenthesis and then OR.


    Is there an easier way?

  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,521
    From a selection of them:

    http://www.baldyweb.com/multiselect.htm

    from all of them, presuming they're in a table, join that table in your query on zip code and it will be restricted to those.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    kdtrimble is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Posts
    41
    Oh boy... Thanks pbaldy but I have no clue as to what this sciprt is and how it's used.

  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,521
    Do you want the report on all 83 zip codes or allow the user to select one or more?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    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,724
    kdtrimble,

    If you know the 83 zips involved, you could put those in a separate table; then create a query to find records where the zips matched those in your separate table.
    Here is a link to a tutorial that may be helpful.
    Note: The sample deal with "exclude", you want the zips to "match/equal".

    Good luck with your project.
    Last edited by orange; 12-13-2018 at 10:51 AM. Reason: spelling

  6. #6
    kdtrimble is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Posts
    41
    all 83 zip codes

  7. #7
    kdtrimble is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Posts
    41
    thank you very much

  8. #8
    kdtrimble is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Posts
    41
    I am getting a type mismatch.
    Click image for larger version. 

Name:	Screenshot 2018-12-14 10.16.51.jpg 
Views:	9 
Size:	101.8 KB 
ID:	36569Click image for larger version. 

Name:	Screenshot 2018-12-14 10.18.39.jpg 
Views:	9 
Size:	103.5 KB 
ID:	36570

  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,521
    Make sure the data types of the fields being joined on are the same in each table.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #10
    kdtrimble is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Posts
    41
    Click image for larger version. 

Name:	Screenshot 2018-12-14 11.06.08.jpg 
Views:	7 
Size:	103.4 KB 
ID:	36571yes, but my problem is I do not know how to check and change them lol. Can you help me please?

  11. #11
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Not without the database. Just look at the tables in design view and check the data types of those fields.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #12
    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,724
    Your zip codes are right justified which is indicative of a number datatype. Since you do not do arithmetic with zip codes, they should be text.
    Good luck.

  13. #13
    kdtrimble is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    Apr 2015
    Posts
    41
    It works! Thank you all so much.
    Attached Thumbnails Attached Thumbnails Screenshot 2018-12-14 11.59.03.jpg  

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

Similar Threads

  1. Query Multiple Zip Codes
    By JackL290 in forum Queries
    Replies: 3
    Last Post: 08-13-2015, 03:36 PM
  2. Filtering query based on multiple rows values
    By GeorgeB in forum Queries
    Replies: 6
    Last Post: 12-05-2013, 06:17 PM
  3. Replies: 5
    Last Post: 08-07-2012, 10:12 PM
  4. Replies: 2
    Last Post: 02-20-2012, 08:32 AM
  5. basic query codes
    By joms222 in forum Queries
    Replies: 1
    Last Post: 03-20-2009, 11:31 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