Can an Access join act like a wildcard search?

In the Query Builder window I have two tables, one has an indexed ItemNo field and in the other table, their is also a ItemNo value in the "Handle Field", however it's in a string that has other values that will of course not exactly match the ItemNo value.  So when I try to join them... no results.

It'd be cool if my join could look through the string for a match and produce the matched results.

I'm sure it's not possible via a join, however what would be a good method to do this?

Thanks, Kevin
itsquadSystems AdminAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
You can actually do this with a JOIN, and a INSTR in the ON clause.  See if this makes sense, and give it a try.

FROM Table1 AS t
INNER JOIN Table2 AS t2 
ON INSTR(t2.Handle, t1.ItemNo) > 0;

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Pawan KumarDatabase ExpertCommented:
You can also use LIKE,=,<>,INSTR..etc in join conditions..

In this case we can easily use like in join condition.

SELECT columnsYouneed...
FROM yourtable1 AS t1
INNER JOIN yourtable2 AS t2 
ON t2.Handle LIKE t1.ItemNo & "*" 

Open in new window

Dale FyeOwner, Dev-Soln LLCCommented:
and if you want all values from Table1 and only the "fuzzy matches" from table 2 use a LEFT JOIN in the above syntax
itsquadSystems AdminAuthor Commented:
Niiiiice!  Never considered that as an option in the SQL window!  I always just looked at the line in the query builder and double clicked it there to select join type... Wish Access had that pre-programmed in there!  Thanks guys!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.