Delete Table/Query

  • Thread starter Thread starter zyus
  • Start date Start date
Z

zyus

Is there any way to delete table & query in just one shot. Sort of select all
table/query name and press delete.

Thanks
 
hi,
Is there any way to delete table & query in just one shot. Sort of select all
table/query name and press delete.
What exactly do you mean? You can write your own VBA sub to do this.

mfG
--> stefan <--
 
Hi,

I use access for reporting purpose. I've created a lot of query & reports. I
want to find a way to delete my queries from query windows by selection and
delete.
 
hi,
I use access for reporting purpose. I've created a lot of query & reports. I
want to find a way to delete my queries from query windows by selection and
delete.
Copy it into a standard module and use it with extreme care:

Public Sub DeleteAllQueries()

Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim qds() As DAO.QueryDef

Dim Count As Long

Set db = CurrentDb
ReDim qds(db.QueryDefs.Count)

For Count = 0 To db.QueryDefs.Count - 1
Set qds(Count) = db.QueryDefs.Item(Count)
Next Count

For Count = 0 To db.QueryDefs.Count - 1
db.QueryDefs.Delete qds(Count).Name
Next Count
db.QueryDefs.Refresh

Set db = Nothing

End Sub


mfG
--> stefan <--
 
hi,

Copy it into a standard module and use it with extreme care:

Public Sub DeleteAllQueries()

Dim db As DAO.Database
Dim qd As DAO.QueryDef
Dim qds() As DAO.QueryDef

Dim Count As Long

Set db = CurrentDb
ReDim qds(db.QueryDefs.Count)

For Count = 0 To db.QueryDefs.Count - 1
Set qds(Count) = db.QueryDefs.Item(Count)
Next Count

For Count = 0 To db.QueryDefs.Count - 1
db.QueryDefs.Delete qds(Count).Name
Next Count
db.QueryDefs.Refresh

Set db = Nothing

End Sub

Zyus, do note that this will delete *EVERY QUERY* in your entire database -
not "by selection". Heed Stefan's warning to "use with extreme care" - it's a
tactical nuclear device, not a rifle!
 
hi John,
Zyus, do note that this will delete *EVERY QUERY* in your entire database -
not "by selection". Heed Stefan's warning to "use with extreme care" - it's a
tactical nuclear device, not a rifle!
Cool ;)


mfG
--> stefan <--
 
Back
Top