Union error in Select query!!!!!

PearlGI

Registered User.
Local time
Today, 20:54
Joined
Aug 30, 2001
Messages
125
Can anyone think of a reason why the following is happening?

I have a Union query which runs off 2 Select queries, this works.
I then have a Select query that runs from the Union query and another Select query, this also works.
This Select query is then used with other Select queries to create another Select query, this also works.

Now here's the problem:
Whenever I try to use this final Select query (even with just a simple SELECT * FROM {select query} ), I get this error message.

'The number of columns in the two selected tables or queries of a union query don't match.'

Why do I now get an apparent error with the Union so far down the line from the point it was created.

Any help, no matter how small, would be greatly appreciated.

[This message has been edited by PearlGI (edited 09-26-2001).]
 
Hi PearlGI

I can't give you an answer as to why you get this warning message ... though I do sympathise with Access as you seem to have query after query after query - very confusing to follow how you have put all this together! In fact, your warning message could be a bit of a red herring ... sometimes Access gives us a message that shows it cannot cope with the task designed but the description is not very accurate (it is often the "nearest description to a scenario never anticipated by the original programmers/designers of Access").

However, I will try to make a couple of suggestions.

Could you not build up to the final required query by using fewer combinations of queries (you seem to have selectx2/union/select/select+other selects/select/select ... 6 layers/levels of queries). Are all these levels necessary?

Alternatively perhaps you could build up to the final stage by just using select queries and then do a union query at the final stage.

HTH

Rich Gorvin

[This message has been edited by Rich@ITTC (edited 09-26-2001).]
 
Many thanks for your help.
smile.gif


Unfortunately the queries do have to be this complex.
It is also just the Union that's causing the problem, as it works fine with just either half of the Union.

Anyway, the only way I can see to eliminate some of the complexity is to use a MakeTable query based on the Union and then pick up this new table to continue the rest of the queries.
This is not an ideal solution as the MakeTable query has to run everytime the input tables change. But at least it now works!
 
Done it!!

To cut a long story short. I've replaced the original Union query with an extremely more complex Select query and Access seems to like it.

Wonders will never cease.
 

Users who are viewing this thread

Back
Top Bottom