How can I enum child forms?

B

Bodi Klamph

Hi

I would like a programmatical way of enumerating the child forms that are
open.

I have a function that refreshes all the comboboxes that are linked to SPs,
but I am unable to requery the subforms because they aren't listed in the
Forms collection. I could create a function that calls the Forms public
method that then requeries the subform by name, but I would prefer to have a
generic method.

Help?

Thanks,
Bodi
 
D

Dan Artuso

Hi,
Here you go:

Public Sub EnumerateSubforms()
Dim frm As Form
Dim ctl As Control

On Error Resume Next
For Each frm In Forms
For Each ctl In frm
If ctl.ControlType = acSubform Then
MsgBox ctl.Name
End If
Next ctl
Next frm
End Sub
 

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