Union Query cannot find last table

Hi

I have the following union query
SELECT HasMessageText.From, HasMessageText.[Sender Name], HasMessageText.Contents, HasMessageText.[Has Attachments]
FROM HasMessageText
UNION  SELECT NoMessageText.From, NoMessageText.[Sender Name], NoMessageText.Contents, NoMessageText.[Has Attachments]
FROM NoMessageText;

The two tables are link to Outlook. Each select statement runs OK on its own, but when in the Union Query I get an error The Microsoft jet database engine cannot find input table or query No Message text (the two table names are aliases to remove spaces - and I have tried with the non alias name with the same error). If I reverse the order of the select satatements in the query then the Has Message Text table returns the error.

Any Ideas here?

Kelvin
LVL 23
Kelvin SparksAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
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.

käµfm³d 👽Commented:
Not sure if this is the answer, but I believe the semi-colon is not supposed to be included when running queries inside Access.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"but I believe the semi-colon is not supposed to be included when running queries inside Access."
Actually it is, and Access will put it they if you remove it.

"the two table names are aliases to remove spaces"
Are you say as posted they are alias's ?  Or are those the real names?  If alias ... where is the AS keyword?

mx

0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
The is no apparent problem with the SQL, so ... something else is going on ...

mx
0
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

käµfm³d 👽Commented:
>>  Actually it is, and Access will put it they if you remove it.

That's what I get for trying to remember something from years back...    good call :)
0
Kelvin SparksAuthor Commented:
Alises - they are linked tables renamed from the source table name, so no AS needed in the query. if I leave the original names in place, I get the same error.
I have a vague recollection of a similar issue some time ago - different client, computer etc...
For now, I've got round it by using a local table and refreshing the data at startup - is static enough for this temporary app and isn't needed long term.
 
Still open to solving it
 
Kelvin
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
I see ... linked.  Can you try deleting the links, doing a Compact and Repair, relink ... and see what happens?

mx
0

Experts Exchange Solution brought to you by

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
Kelvin SparksAuthor Commented:
Didn't solve it, but appreciative of the effort.
0
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
"Didn't solve it, but appreciative of the effort. "

Sorry ... definitely WEIRD !!

mx
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.