We help IT Professionals succeed at work.
Get Started

Query Help - possible VBA solution? Array?

Last Modified: 2020-03-04
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))

Thanks for all help!
Watch Question
Social distance; Wear a mask; Don't touch your face; Wash your hands for 20 seconds
Top Expert 2014
This problem has been solved!
Unlock 2 Answers and 31 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE