DAO, deleting MSAcces 2000 queries

Can anyone tell me why the code provided below only seems to delete about 8 queries max? It then complains that the object is no longer set. (I used a reference to Microsoft DAO 3.6 Object Library)

Dim db As dao.Database
Dim qd As QueryDef

Set db = DBEngine.Workspaces(0).OpenDatabase(CurDir & "db.mdb")

For Each qd In db.QueryDefs
db.QueryDefs.Delete qd.Name


Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!