troubleshooting Question

Query Help - possible VBA solution? Array?

Avatar of Coleen Sullivan
Coleen SullivanFlag for United States of America asked on
Microsoft AccessVBASQL
31 Comments2 Solutions283 ViewsLast Modified:
Hello Experts,

I need help with an Access query that checks a 'Business_Name' field in a table with approximately 1.3m records, against a table of about 300 corporate identifier codes.  
My query provides results, but they are not complete.  I've included both tables (unjoined) and I'm using an InStr function to get these results.  I have a feeling there is a solution for this but that it will involve VBA, which I am NOT proficient in!

I've provide my SQL below.  FYI -  [business_name_tx] is in table "T_UCVI" and  [Code] is in table "T_BusinessCodes"

My current SQL:  
SELECT DISTINCTROW T_UCVI.ID, T_UCVI.BUSINESS_NAME_TX, InStr(1,[business_name_tx],([code])) AS Corp1, InStr(2,[business_name_tx],(" " & [code])) AS Corp2
FROM T_BusinessCodes, T_UCVI
GROUP BY T_UCVI.ID, T_UCVI.BUSINESS_NAME_TX, InStr(1,[business_name_tx],([code])), InStr(2,[business_name_tx],(" " & [code]))
HAVING (((InStr(1,[business_name_tx],([code])))=1)) OR (((InStr(2,[business_name_tx],(" " & [code])))>1))
ORDER BY T_UCVI.BUSINESS_NAME_TX;

Thanks for all help!
ASKER CERTIFIED SOLUTION
aikimark
Get vaccinated; Social distance; Wear a mask
Join our community to see this answer!
Unlock 2 Answers and 31 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 31 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros