delete all queries from a database so I can start fresh?

D

Douglas J. Steele

The following VBA should delete all queries from your application:

Dim dbCurr As DAO.Database
Dim lngLoop As Long

Set dbCurr = CurrentDb()
For lngLoop = (dbCurr.QueryDefs.Count - 1) To 0
dbCurr.QueryDefs.Delete qdfCurr.Name
Next lngLoop
 
J

John Spencer

Whoops should not the For lngLoop ... line include step -1?


Dim dbCurr As DAO.Database
Dim lngLoop As Long

Set dbCurr = CurrentDb()
For lngLoop = (dbCurr.QueryDefs.Count - 1) To 0 Step -1
dbCurr.QueryDefs.Delete qdfCurr.Name
Next lngLoop



'====================================================
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
'====================================================
 
D

Douglas J. Steele

AAAARGGH! It wasn't my day, was it?

Dim dbCurr As DAO.Database
Dim lngLoop As Long

Set dbCurr = CurrentDb()
For lngLoop = (dbCurr.QueryDefs.Count - 1) To 0 Step -1
dbCurr.QueryDefs.Delete dbCurr.QueryDefs(lngLoop).Name
Next lngLoop

Thanks John & Rick.

Sorry, Earl.
 
Top