Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search for a query

Status
Not open for further replies.

EscapeUK

Programmer
Jul 7, 2000
438
GB
How do I in code search for a query, if it exists i want to delete it
 
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

the kid
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top