QueryDefs.Delete

  • Thread starter Thread starter marc
  • Start date Start date
M

marc

Can someone give me the complete code to eliminate a Query
Definition?

What I'm trying is:

Dim strSQL As String
Dim db As DAO.Database
Dim Q100 As DAO.QueryDef
Set db = CurrentDb

Set db.QueryDefs.Delete Q100.Name

But it doen't work

Thank you,

marc
 
marc said:
Can someone give me the complete code to eliminate a Query
Definition?

What I'm trying is:

Dim strSQL As String
Dim db As DAO.Database
Dim Q100 As DAO.QueryDef
Set db = CurrentDb

Set db.QueryDefs.Delete Q100.Name

But it doen't work


DoCmd.DeleteObject acQuery, "QueryName"
 
You haven't set Q100 to any particular querydef. There needs to be something
like
Set Q100 = db.QueryDefs(" ")
 
Related to this issue, how do you make sure that the file(s) existed before you deleted them
I use the same delete method of querydefs but it only works if the file exists, now I have to put a condition to make sure if it is exist

TIA
Djoezz
 
Back
Top