SQL Union Query - Code Not Visible

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, As the subject suggests I have an SQL Union Query which runs fine and
produces the results I needed.

I now need to alter this code to change / add / remove fields but when I go
to design the SQL Code - there is no code visible and nothing to highlight
and copy out - but the query does run fine.

Can anybody help get my code back as it was quite lengthy.

Thanks.
 
I can think of at least four different places I could stick a SQL UNION
query expression. Where's yours?
 
Assuming that your union query is a saved query - it has a name in the
queries collection. You might be able to recover the text (if it exists)
using someVBA similar to:

Currentdb.QueryDefs("query1").SQL

You can type that in the VBA immediate window as
?Currentdb.QueryDefs("query1").SQL
and after pressing Enter key you should get the text of the SQL, which you
can then copy and paste.

If this returns nothing, then I would start checking to see if the query
that is executing is being created in a module, is the record source of a
form that you are using, etc.
 
OK, in a (as a) query (top candidate, since you posted in the queries
newsgroup), as a SQL statement in code "behind a form", or "behind a
report", or in a code module?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

UNION QUERY 2
Union Query 4
trouble with union query 2
Join on a UNION query 2
merging 2 queries 3
Duplicates in union query 3
Make-Table AND Union Query 2
Union query 5

Back
Top