Results 1 to 4 of 4
  1. #1
    ctakacs is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    4

    Possible to use query is LIKE condition?

    Hi Folks -



    I have another thread going with an issue I am having and I'm trying out a few ideas I have.

    I have a question with may be stupid, but possible to use a query is a LIKE condition?

    For instance:
    Code:
    SELECT [Long_Code]
    FROM [LT-SAP_CC_CMSO_Mapping]
    WHERE [Long_Code] LIKE     '*(SELECT 
                                    Switch(
                                        Len(Nz([Host Country Cost Center - ID], [Cost Center - ID])) - Len(Replace(Nz([Host Country Cost Center - ID], [Cost Center - ID]), "_", "")) > 0, Mid(Nz([Host Country Cost Center - ID], [Cost Center - ID]),InStrRev(Nz([Host Country Cost Center - ID], [Cost Center - ID]),"_")+1),
                                        Len(Nz([Host Country Cost Center - ID], [Cost Center - ID])) - Len(Replace(Nz([Host Country Cost Center - ID], [Cost Center - ID]), "-", "")) > 0, Mid(Nz([Host Country Cost Center - ID], [Cost Center - ID]),InStrRev(Nz([Host Country Cost Center - ID], [Cost Center - ID]),"-")+1)
                                    ) FROM [LT-Global_Monthly_Headcount] 
                              )*'
    Thanks!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    select * from table where [field] like "*ology"

  3. #3
    ctakacs is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    4
    Yes I know how to do that. I was trying to make it more dynamic though and use a query...not possible?

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2016
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    Perhaps you should tell us in plain English WHAT you are trying to do and include an example showing
    a) some sample data, and
    b) the result that should be selected from that data by your Query.

    As a side note, Access does not work well with field and object names with embedded spaces or special characters("-"...). Sooner or later you will experience some syntax issues.

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

Similar Threads

  1. Query help to write a condition
    By Dgalaxy in forum Access
    Replies: 6
    Last Post: 06-03-2020, 11:34 AM
  2. Check box in query condition: is this possible?
    By WesHarding in forum Queries
    Replies: 7
    Last Post: 03-22-2017, 11:30 AM
  3. Need help with condition in a query
    By NightWalker in forum Queries
    Replies: 1
    Last Post: 09-30-2016, 01:18 PM
  4. If Condition Query in Access
    By Vishan in forum Queries
    Replies: 3
    Last Post: 10-30-2012, 12:05 PM
  5. Help with writing Query If Then Condition
    By taimysho0 in forum Queries
    Replies: 4
    Last Post: 01-20-2012, 06:09 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