SubForms

  • Thread starter Thread starter Guest
  • Start date Start date
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!
 
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
 
Back
Top