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

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
'====================================================
 
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.
 
Back
Top