deleting a query

jordan0904

Registered User.
Local time
Today, 22:01
Joined
Jul 19, 2000
Messages
13
I create a query like this:
set qd=db.createquerydef("query.....
docmd.openquery "query"
ect...
anyway next time i run this code I would like to check if this query exsists and delete it before creating it again.
 
This might be a bit simplistic, but if you are creating a temporary query, only for use during the procedure, what I would do is delete the query at the end of the procedure.

This will I hope ensure that when you create it again it won't exist.

Deleting it at the end of the procedure will also ensure that it isn't saved anywhere.

Hope I'm on the right lines.
 
This code at the beginning of your code should solve your problem, if you do not delete it after running it as suggested in the previous answer....

If the query does not exist you will get an error so be sure to trap for it.

db.querydefs.delete ("YourQueryName")

HTH,
Jack
 

Users who are viewing this thread

Back
Top Bottom