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

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
 
S

Stuart McCall

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'.
 
T

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'.

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

Thomas Wiedmann
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top