Results 1 to 4 of 4
  1. #1
    amad is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    2

    How to Join tables on a partial string match in MS Access

    Hi Friends,

    I have two huge tables "FirstTable" and "SecondTable" imported to access and I'd like to query between these two tables for records that have Part numbers (under a name "P/N") in both tables.





    I have two issue her:
    First: One table -FirstTable- contain just first 10 digit of Part Numbers and the other table -SecondTable- has full Part Numbers such as “6435J32457” and other “6435J32457p004”.
    Second: Some Part numbers not available in both tables and other table -SecondTable- has more than 10,000 records without P/N, So when i join them i got a hug records that i don’t need.


    I need query to (1)return all records where P/N is partial string match between two tables, (2)does not include all blank values in P/N for FirstTable.

    I appreciate any assistance you can provide. Thanks

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    In the query criteria row of the field for the table that has the entire record put Like "*" & [fieldname] & "*" where fieldname is the name of the field where only part of the value is entered. You should not need to add AND <> NULL to that if the join between your tables is a inner join since NULL would not be LIKE any value in the table which has the partial number. I presume you know how to create a query and join the two tables.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    amad is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jun 2016
    Posts
    2
    Thank you Micron, I create a query and i put the following:

    WHERE
    (((FirstTable.P/N) Like" *" & [SecondTable].[P/N] & "*");

    it Works, Thanks

    what about the other issue for removing Null from my query and how i put it inside WHERE.

  4. #4
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,803
    Try Is Not Null in the query criteria row for the field for [second table].[p/n]
    I think it should end up as
    WHERE(((FirstTable.P/N) Like" *" & [SecondTable].[P/N] & "*") AND [SecondTable].[P/N].Is Not Null

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

Similar Threads

  1. Query to find Partial Match of Column Data
    By rachmorr9 in forum Queries
    Replies: 2
    Last Post: 09-22-2015, 09:09 PM
  2. Delete Partial String HELP!!
    By Crawfordrider33 in forum Access
    Replies: 2
    Last Post: 05-15-2015, 11:31 AM
  3. Partial Match Query
    By punna111 in forum Queries
    Replies: 10
    Last Post: 08-20-2014, 03:35 PM
  4. Replies: 3
    Last Post: 06-11-2014, 08:06 AM
  5. Replies: 1
    Last Post: 03-22-2010, 03:37 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