Query not opening in design view

LomaxE

New member
Local time
Today, 05:43
Joined
Jul 1, 2010
Messages
8
Hi,

Just this morning I set up a new create table query in a new 2003 database. The query was too complex at first so I removed a load of criteria meaning to do it in a later query. At which point it worked ok. At some point the database must have been shut down and when I reopened it again I found that I could no longer open the query in design view in order to edit it. It still runs fine, it's just if I try to open in DV then then the timer just appears and then seems to time out and disappear after a while with no errors.

Is there a way to get at the SQL or design view again or will I just have to recreate the query? I've tried compacting and comparing.

Thanks in advance!
 
No you don't have to recreate the query from scratch, you can retrive the SQL string from the querydefs collection.

Paste the little function in a Standard module:

Code:
Function qSQL() As String
Dim qdf As QueryDef
Set qdf = CurrentDb.QueryDefs("NameOfYourQuery")
qSQL = qdf.SQL
End Function

And in the immediate window type this and hit enter:

?qsql

The sql should be printed in the immediate window, copy and paste it in a new query and see if that helps.

JR
 
Ah that worked...

I then simplified the query further and was able to get it to open normally again. Will have to keep that vba solution safe somewhere for if it ever happens again.

Thanks JANR!
 

Users who are viewing this thread

Back
Top Bottom