-----Original Message-----
That's what I meant by the last paragraph. When the 1st QueryDef is
deleted, the 2nd becomes the first, the 3rd becomes the second. Thus in
next iteration, the (original) 3rd Query is deleted and the (original) 2nd
remains. Similar for the 4th QueryDef.
Use For loop like: (***Untested***)
Dim dbs As DAO.Database
Dim qdfs As DAO.QueryDefs
Dim qdf As DAO.Querydef
Dim intCount As Integer
Dim intIndex As Integer
set dbs = currentdb()
Set qdfs = dbs.QueryDefs
intCount = qdfs.Count
For intIndex = intCount -1 To 0 Step -1
Set qdf = qdfs.Item(intIdex)
if left (qdf.Name,3) = "qry" then
dbs.querydefs.delete qdf.name
end if
Next intIndex
dbs.close
Set qdf = Nothing
Set qdfs = Nothing
Set dbs = Nothing
--
HTH
Van T. Dinh
MVP (Access)
.