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!

Deleteing dbs objects.

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
Hello,

I have defined an sql statement, to automatically create a
querydef called dummy, as below :-

Set qdf = dbs.CreateQueryDef("dummy", strSQL)

This works great the first time, but upon second go, as the object has already been created, I get "object already exists" message.

I have tried to do this earlier in the code

Set qdf = dbs.QueryDefs.Delete("dummy")

which just stops the code working altogether.

Is there another way of deleting, or overwriting the object.

thanks
 
set object = nothing
penny.gif
penny.gif
 
Setting to nothing removes the reference to the object, NOT the object. A way is to create the dummy querydef as most any thing, thte after instantiating it via:

Set qdf = dbs.QueryDefs("dummy")

Set it's SQL PROPERTY

qdf.Sql = strSQL

Another way is to create an UNNAMMED query def:

Set qdf = dbs.CreateQueryDef(, strSQL)


MichaelRed
redmsp@erols.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