Results 1 to 6 of 6
  1. #1
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170

    50+ Or Criteria is there a better way?

    Hi Folks,



    I am trying to find a long list of records with [LID] as the criteria. Is there anyway to augment this query:

    Code:
    SELECT [maintable].LID, [maintable].Operator, [maintable].Process, [maintable].[Shift Type], [maintable].Notes, [maintable].[Time Added]
    FROM [maintable]
    WHERE ((([maintable].LID)=123)) OR ((([maintable].LID)=456)) OR ((([maintable].LID)=789))
    To something like this:

    Code:
    SELECT [maintable].LID, [maintable].Operator, [maintable].Process, [maintable].[Shift Type], [maintable].Notes, [maintable].[Time Added]
    FROM [maintable]
    WHERE ((([maintable].LID)=
    123
    456
    789
    102
    134
    47
    8
    6
    411
    222
    ))
    I am essentially looking for a more elegant/less painful way to query multiple OR Criteria?

    Thanks!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Try:

    WHERE [maintable].LID IN (123, 456, 789)

    Filter a form or report instead of directly in query:

    http://allenbrowne.com/ser-50.html
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170
    Perfect and as always thank you.

    I know this is an Access forum but I think you probably know the answer to this as well.

    In Excel,

    Is there a way to bring several hundred rows of cells into one cell i.e.

    =$A$1&", "&A2&", "&A3&", "&A4&", "&A5&", "&A6&", "&A7&", "&A67&", "&A68

    But NOT manually typing out each cell value?

    I tried something like $A$1&", "$A2&":"&A67&", "&A68 but no dice....

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Use VBA (called macros in Excel)?

    What does the & mean in that usage?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    athyeh is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Jun 2013
    Posts
    170
    It's a form of Concatenate function, found a great resource about concatenating ranges of cells here:

    http://excel.tips.net/T003062_Concat..._of_Cells.html

    Thread solved.

    Thank you for your replies.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Yep - there's a LOT of functions in Excel I am not familiar with. Thanks for sharing solution.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 4
    Last Post: 05-02-2013, 11:07 AM
  2. Replies: 5
    Last Post: 09-20-2012, 03:27 PM
  3. Replies: 5
    Last Post: 08-02-2012, 09:44 AM
  4. Replies: 1
    Last Post: 07-13-2011, 11:00 AM
  5. Search By Criteria - Flexible Criteria Fields
    By lilanngel in forum Access
    Replies: 0
    Last Post: 03-16-2011, 06:25 PM

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