If all you want to do is DELETE all the forms or all the reports you can step
through the documents in the container in reverse order.
Make sure you have a backup before you do this.
UNTESTED code follows
Public Sub sDeleteAllForms()
Dim i As Long
For i = CurrentProject.AllForms.Count - 1 To 0 Step -1
DoCmd.DeleteObject acForm, CurrentProject.AllForms(i).Name
Next i
End Sub
You can do the same thing with containers. The trick is to step through the
collection from the highest number to the lowest number so that the reordering
of the collection does not affect the position of the next object to be deleted.
The equivalent code using containers would be
Dim db As DAO.Database
Dim C as Container
Dim i as Long
Set db = CurrentDb()
Set c = db.Containers("Forms")
For i = c.Documents.Count - 1 To 0 Step -1
DoCmd.DeleteObject acForm, c.Documents(i).Name
Next i
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
Long time back, I have seen a function/sub that listed all Forms or report
thru the enumeration of domunets in the container. I think It was when
Access 2000 or 2002 release.
My aim is to write a function to delete all forms and reports
SF