SubForms

G

Guest

I need to be able to parse through all open forms AND SUBFORMS to call a
module for each form and subform.

I can parse active forms by

Public Sub reset_all_forms()
Dim intIndex As Integer
For intIndex = Forms.Count - 1 To 0 Step -1
set_form_colors Forms(intIndex)
Next intIndex
End Sub

this works great, but some of the forms contain subforms in them....how do I
find out the subform names so I can run set_form_colors on them?

Thanks in advance for your help!
 
A

Allen Browne

For each form in the Forms collection, loop through its controls. When you
find one of type acSubform, use its .Form property to pass a reference to
the form it contains.

Of course, a subform can contain another subform, so you need this code to
call itself recursively. This article has an example of code that calls
itself recursively to set the properties of controls on a form an all depths
of subform:
Locking bound controls
at:
http://allenbrowne.com/ser-56.html
 

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

Similar Threads


Top