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?
 
DatabaseMX (Joe Anderson - Microsoft Access MVP)Connect With a Mentor Database ArchitectCommented:
I see ... linked.  Can you try deleting the links, doing a Compact and Repair, relink ... and see what happens?

mx
0
 
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 ArchitectCommented:
"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
Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

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

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

Sorry ... definitely WEIRD !!

mx
0
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.