Checking for subforms on a form

J

James Martin

What is the best way to check in VBA for all the subforms on a form? I can
cycle through all the controls on the form checking for
ControlType=acSubForm. But some of my forms have a massive number of
controls and I'm wondering if there is a more efficient way.

Thanks in advance.

James

P.S. I suppose I could also cycle through the forms collection looking for a
form with my form as the parent, but I suspect that will be slow.
 
D

Douglas J. Steele

I believe that what you're doing is the only way.

You can't cycle through the Forms collection looking for forms with your
form as a parent because subforms don't get added to the Forms collection.
 

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