Results 1 to 6 of 6
  1. #1
    Johanb26 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    25

    Find query - help please

    Hi guys,

    We have an access database, but I am exporting the data to excel via an ODBC connection.

    When doing this I want to select queries from more than one section for an excel sheet can somebody please advice.

    As an example:

    I have 5 different sections and normally each section would go onto a different sheet in excel, but now my engineering manager has gone filter crazy and wants everything on the same sheet.

    So this is what I am trying to do:



    Code:
    SELECT cust_id, cust_section
    FROM unit
    WHERE cust_section = 'section A';
    But now I want to include section b, section c, etc... in the same query can somebody please help with the syntax ?

  2. #2
    lfpm062010 is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Location
    US
    Posts
    415
    WHERE Cust_Section = 'section A'
    OR Cust_Section = 'section B'
    OR Cust_Section = 'section C'
    OR .... etc

  3. #3
    Johanb26 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    25
    Quote Originally Posted by lfpm062010 View Post
    WHERE Cust_Section = 'section A'OR Cust_Section = 'section B'OR Cust_Section = 'section C'OR .... etc
    But will this not only select section a or section b ? I want to select all the sections.

  4. #4
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Why do we have the "WHERE" clause? What happens if we remove it ?
    Have you tried lfpm062010's suggestion ?
    Explore "<>" and "AND" in "where" clause.

    Thanks

  5. #5
    Johanb26 is offline Novice
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Posts
    25
    Quote Originally Posted by recyan View Post
    Why do we have the "WHERE" clause? What happens if we remove it ?
    Have you tried lfpm062010's suggestion ?
    Explore "<>" and "AND" in "where" clause.

    Thanks
    Hi the OR syntax did work thanks.

    I was just being an idiot. I guess it comes from sleep deprivation ��

  6. #6
    recyan's Avatar
    recyan is offline Expert
    Windows 2K Access 2000
    Join Date
    Dec 2011
    Posts
    662
    Totally understand the part about sleep deprivation playing tricks.
    Glad you got things working. In case you have not explored the other options, just try them & see what happens, whenever free.

    Thanks

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

Similar Threads

  1. Query, find duplicates
    By gmaster in forum Queries
    Replies: 2
    Last Post: 05-27-2014, 06:58 AM
  2. Query to find what isn't there
    By NISMOJim in forum Queries
    Replies: 4
    Last Post: 08-29-2013, 01:18 PM
  3. Replies: 3
    Last Post: 10-17-2012, 09:24 AM
  4. Can't Find Misspelled Query Name
    By jhillbrown in forum Access
    Replies: 5
    Last Post: 03-11-2010, 02:28 PM
  5. Query to find lowest value
    By AccessNubie in forum Access
    Replies: 3
    Last Post: 11-30-2009, 07:54 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