SQL Union Query - Code Not Visible

W

WildThing

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

Jeff Boyce

I can think of at least four different places I could stick a SQL UNION
query expression. Where's yours?
 
W

WildThing

Hi, Plenty of places i'd like to stick it at the moment but its currently in
Access 2000.
 
J

John Spencer

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

Jeff Boyce

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?
 
Top