Results 1 to 7 of 7

Matching Query

  1. #1
    sathishkm21 is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2017
    Posts
    4

    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 online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    45,843
    There is no attachment.

    I expect you will need to build VBA function.
    To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.

  3. #3
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    4,849
    seems you forgot the attachment.
    match any word
    You mean any word that you specify?
    - "doesn't work" is no help. Post err msgs and where.
    - Use code tags for code/sql. Implement changes in copies of your database.
    So, like, why do you, like, start every sentence with, like, "so"?

  4. #4
    sathishkm21 is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2017
    Posts
    4
    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
    13,337

  6. #6
    sathishkm21 is offline Novice
    Windows 10 Access 2007
    Join Date
    Jul 2017
    Posts
    4
    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 online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    45,843
    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;
    To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. Attachment Manager is below Advanced editor window, click Go Advanced below Quick Reply window.

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

Similar Threads

  1. Replies: 11
    Last Post: 07-19-2018, 10:13 AM
  2. Replies: 5
    Last Post: 04-05-2018, 12:59 AM
  3. point matching query
    By Shales in forum Access
    Replies: 5
    Last Post: 04-20-2016, 09:25 AM
  4. Replies: 1
    Last Post: 10-24-2011, 07:01 AM
  5. Matching Query Dates
    By rgwynne in forum Queries
    Replies: 1
    Last Post: 08-13-2009, 04: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
  •  
Tech Forums: Microsoft Office Forums