How to list the names of forms and reports of an .mdb database by VBA

  • Thread starter Thread starter Thomas Wiedmann
  • Start date Start date
T

Thomas Wiedmann

Hello,

my MS Access database has some forms and reports, but both statements
Application.Forms.Count
Application.Reports.Count
return 0 in a Sub procedure of the Module section and thus also there is no
iteration of the collections like

Dim frm As Form
For Each frm In Application.Forms
....

What may be the reason?
How can I list the names of all forms and reports, available in a .mdb
database, by VBA?

Currently I work with MS Access 2007.

Thomas Wiedmann
 
Thomas Wiedmann said:
Hello,

my MS Access database has some forms and reports, but both statements
Application.Forms.Count
Application.Reports.Count
return 0 in a Sub procedure of the Module section and thus also there is
no iteration of the collections like

Dim frm As Form
For Each frm In Application.Forms
...

What may be the reason?
How can I list the names of all forms and reports, available in a .mdb
database, by VBA?

Currently I work with MS Access 2007.

Thomas Wiedmann

Sounds like all you need is a big clue. Here it is. The Forms collection
contains the names of all _open_ forms in an app. However, the AllForms
collection contains the names of all the forms (open or otherwise) in an
app. Search help for 'AllForms'.
 
Sounds like all you need is a big clue. Here it is. The Forms collection
contains the names of all _open_ forms in an app. However, the AllForms
collection contains the names of all the forms (open or otherwise) in an
app. Search help for 'AllForms'.

Thanks for this info - it answered my question.
Application.CurrentProject.AllForms
is the collection, I've searched for.

Thomas Wiedmann
 
Back
Top