Question about Forms collection

J

John

I have a super form with a tabbed control that has 6 tabs each with
its own sub form(s). A Total of 8 forms involved.

Form Hierarchy is as Follows
Super Form
Family Tab
Family Contacts Sub Form
Information Tab
Information Sub Form
Performance Tab
Performance Search Form
Performance Sub Form
Product
Product Search Form
Product Sub Form
Reports
Reports Sub form

I have been coding a set of business rules for this database and I've
come across a problem

According to Access Help Menu the "The Forms collection contains all
of the currently open forms in a Microsoft Access database." I open
the super form which in theory should open all 7 sub forms and put
them in the Application.Forms collection

Yet in code when I debug in the immediate window Forms.Count = 2

The Super form and the Performance Sub form are the only two forms
which show.

Whats even stranger is the code I am executing is running behind the
Information Sub Form and this form doesnt show in the Forms
Collection.

The question is Why does the performance sub form show in the
collection and not its parent Performance Search form, and why don't
the rest of the sub forms show in the Forms collection?


John
 
K

Ken Snell \(MVP\)

Subforms are not open as forms; they are objects within the main form that
holds them. Therefore, they do not appear in the Forms collection; only the
main forms do.
 
J

John

I read yesterday that sub forms are not actually forms but are
controls on the super form.

but the problem I see is that I do have a sub form that shows in the
collection "performance sub form". This sub form is nested 3 tiers
deep. But then again so is the Product Sub Form and it doesnt show.

Reguardless I found a way to work around the Forms collection.

Still have you ever see or had a situation where there are two sub
forms at the same level and 1 shows in the collection and 1 doesnt?
 
K

Ken Snell \(MVP\)

John said:
I read yesterday that sub forms are not actually forms but are
controls on the super form.

That is correct.

but the problem I see is that I do have a sub form that shows in the
collection "performance sub form". This sub form is nested 3 tiers
deep. But then again so is the Product Sub Form and it doesnt show.

Subforms will not show in the Forms collection unless you have directly
opened the form that you're using as the subform. You can have that form
open at the same time that the subform is "open" in the main form.

Reguardless I found a way to work around the Forms collection.

Still have you ever see or had a situation where there are two sub
forms at the same level and 1 shows in the collection and 1 doesnt?

No.
 

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