query won't open in design mode in Access 2000

J

Jools

I have a query that won't open in design for me to edit it. It is the third
query in a set. 1st one opens fine ,2nd one is slower but 3rd just won't open
at all. Tables are all linked ok and it did used to work. Iv'e run a compact
repair database that hasn't helped at all.
Help
 
P

Pieter Wijnen

Try something like this:

Sub CopyQuery()
Dim Db AS DAO.Database
Dim BadQDef AS DAO.QueryDef, NewQdef As DAO.QueryDef
Set Db = Access.CurrentDb
Set BadQdef = Db.QueryDefs("TheBadQuery")
Set NewQdef=Db.CreateQueryDef("TheBadQueryCopy",BadQdef.SQL)
NewQDef.Close : Set NewQdef = Nothing
BadQdef.Close : Set BadQdef = Nothing
Db.Querydefs.refresh
Set Db = Nothing
End Sub

HTH

Pieter
 
Top