Is it necessary for u to search the query?
You can just try to delete it.
dim db as database
set db = currentdb
db.querydefs.delete "myqueryname"
you really want to search it before you delete it:
For i = 0 To db.QueryDefs.Count - 1
If db.QueryDefs(i).Name = "myqueryname" Then
db.QueryDefs.Delete "myqueryname"
Exit For
End If
Next i
You need to itterate through the querydefs collection. One of the Ms. Access Help examples on querydefs does this quite nicely (itterating through the collection). DeleteObject removes the ofending thinggggy.
MichaelRed
mred@duvallgroup.com
There is never time to do it right but there is always time to do it over
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.