Avatar of JENNIFER NEWTON
JENNIFER NEWTON
Flag for United States of America asked on

Doing a Lookup to find the Values on one Table within a Cell of a second Table without an Exact Match

Sorry for the Title Gore.

I have a cell where users enter qualification codes.  Sometimes it's a single code, but sometimes it's multiple codes separated with a comma.

I have a table with additional information for these codes.  Each row of that table is one code.

I have a report that returns the additional information of the codes, but only if they're present.

The problem is I don't know of a way to return the additional information when multiple codes are present in the first cell.  And even if it did look within the cell for matches, some codes are parts of other codes.  So a code of "V" is within a code of "V2" even though "V" and "V2" are different codes.

Example:

Users fill out data on a table, and enter the appropriate codes as needed

 Table for Users
The second table has the descriptions.  I want to somehow match the codes on the first table with the second table and pull the descriptions

Table with Descriptions
In the above example the codes pulled from the second table should be S, SW, C, R.
Microsoft Access

Avatar of undefined
Last Comment
Dale Fye

8/22/2022 - Mon
crystal (strive4peace) - Microsoft MVP, Access

in the First table, with more than one code ... is this a regular text field, or a multi-value field?
ASKER CERTIFIED SOLUTION
Dale Fye

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Dale Fye

I would not normally recommend storing more than one code in a single field of the table.  I would generally (ALWAYS) create a separate table with a one-to-many relationship between your TestID (TestDate, TestLocation) and the Weather code.  The best way to do this is via a subform for entering the associated WeatherCode values with each test.
crystal (strive4peace) - Microsoft MVP, Access

I agree with Dale.  It is much better to create a related table with one code per record -- then matching things up is easy!
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
JENNIFER NEWTON

ASKER
Wow, this code works like a charm!  Thank you so much, Dale!
JENNIFER NEWTON

ASKER
FYI anyone reading this later.  I agree with Dale and Crystal that adding multiple codes into a single cell is sloppy design.  However this is how our current software works and I can't change it.  "I didn't start the fire" as they say, I can only work with what I have.
Dale Fye

Glad I could help.

That WHERE clause is not very efficient, but it does accomplish the task at hand.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.