Avatar of Fordraiders
Fordraiders
Flag for United States of America asked on

joining two tables on primary key but with just first 10 characters

I had this question after viewing disregard leading zero in query.


Access 2010 vba

I have 2 tables:
table1 primary key    MyKey1
SLS-002213-MAIN-A1   is an example value

table2 primary key    MyKey2
SLS-002213   is an example value

So in order to get the join to work:
I just need the text in MyKey1 to be just 10 characters to match  MyKey2 primary key.



Thanks
fordraiders
Microsoft AccessVBA

Avatar of undefined
Last Comment
PatHartman

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Kelvin Sparks

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.
SOLUTION
PatHartman

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.
SOLUTION
Gustav Brock

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
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Fordraiders

ASKER
pat, always enjoy the comments. Unfortunately I inherit things i cant change.
But I agree.

dp
Fordraiders

ASKER
thanks all
PatHartman

Sometimes you can do a restructure with minimal disruption.  You would have to rename the tables and then create a query that joins them back so they look like the original table and you just give the new query the name of the original table.  It's a bit hokey but it might end up saving a lot of effort in the long run.

Anyway, I understand the limitations for existing apps so good luck.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes