Link to home
Start Free TrialLog in
Avatar of Kelvin Sparks
Kelvin SparksFlag for New Zealand

asked on

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
Avatar of kaufmed
kaufmed
Flag of United States of America image

Not sure if this is the answer, but I believe the semi-colon is not supposed to be included when running queries inside Access.
"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

The is no apparent problem with the SQL, so ... something else is going on ...

mx
>>  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 :)
Avatar of Kelvin Sparks

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
DatabaseMX (Joe Anderson - Former Microsoft Access MVP)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Didn't solve it, but appreciative of the effort.
"Didn't solve it, but appreciative of the effort. "

Sorry ... definitely WEIRD !!

mx