Results 1 to 7 of 7
  1. #1
    sathishkm21 is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2017
    Posts
    6

    Matching Query

    Hi All,



    I have Company column and Domain Column. Here I need a query to match any word from the Company with Domain and mark as True or False. Please find the attachment

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    There is no attachment.

    I expect you will need to build VBA function.
    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
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    seems you forgot the attachment.
    match any word
    You mean any word that you specify?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  4. #4
    sathishkm21 is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2017
    Posts
    6
    Please find the attachment
    Attached Files Attached Files

  5. #5
    orange's Avatar
    orange is online now Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716

  6. #6
    sathishkm21 is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2017
    Posts
    6
    Example: "2 Sisters Food Group" in this company and " https://www.2sfg.com" web address. I want any of the word from company field like "2" or "Sister" or "Food' or "Group" word should match in web address field. In this case 2 is matching in web address. So it should return True.

  7. #7
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,822
    Place code in a general module, something like:

    Code:
    Function TestMatch(strSource As String) As Boolean
    Dim aryString As Variant
    Dim x As Integer
    aryString = Split(strSource)
    For x = 0 To UBound(aryString)
        If Not IsNull(DLookup("Webaddress", "Table1", "Webaddress LIKE '*" & Replace(aryString(x), "'", "''") & "*'")) Then TestMatch = True
    Next
    End Function
    Replace() function is handling possibility of apostrophe in company name, such as: Adam's Bakery. If you prefer, can replace with empty string instead of the doubled apostrophe.

    Then call the function in query:

    SELECT Table1.ID, Table1.Company, Table1.Webaddress, TestMatch([Company]) AS M FROM Table1;
    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: 6
    Last Post: 01-03-2021, 05:06 AM
  2. Replies: 11
    Last Post: 07-19-2018, 11:13 AM
  3. point matching query
    By Shales in forum Access
    Replies: 5
    Last Post: 04-20-2016, 10:25 AM
  4. Replies: 1
    Last Post: 10-24-2011, 08:01 AM
  5. Matching Query Dates
    By rgwynne in forum Queries
    Replies: 1
    Last Post: 08-13-2009, 05:23 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