query returns nothing

I imported a spreadsheet into tbl_A.
I imported a text file into tbl_B.

tbl_A that has corresponding information on tbl_B.  I verified this by manually searching tbl_B using a few of the entries from tbl_A -- and was able to locate the corresponding rows.

Next I created a select query joining the two tables on 'userid' -- but no records are returned.

The 'userid' field in both tables is formatted as Text.  The only difference is the size of the field.  But even when I make the field sizes the same -- I don't get any results......

Here is the query SQL:

SELECT tbl_A.UserID, tbl_B.UserID, tbl_B.LastName, tbl_B.FirstName
FROM tbl_A INNER JOIN tbl_B ON tbl_A.UserID = tbl_B.UserID;

Any ideas why I'm not getting expected results?

Thank you,
Jeanne ElmuccioAsked:
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.

Ess KayEntrapenuerCommented:
Use trim

SELECT tbl_A.UserID, tbl_B.UserID, tbl_B.LastName, tbl_B.FirstName
FROM tbl_A INNER JOIN tbl_B ON trim(tbl_A.UserID) = trim(tbl_B.UserID)

Experts Exchange Solution brought to you by ConnectWise

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
Jeanne ElmuccioAuthor Commented:
Thanks!!!  worked perfectly...

Ess KayEntrapenuerCommented:
problem was, you not only had diffent fields, but also spaces in the field
So username "MY USERNAME" <> " MY USERNAME"

You might want to make the program, so that all spaces are removed from the beginning and end of the fields before saving
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.