retrieve the name of all subforms

T

Tiago Pinto

Hi,

I'm using a form that includes many subforms.
What I would like to do is to update the subform's functions after changing
a value in a combobox that is in the mainform.
To do that I would like to retrieve the name of all subforms, so I can call
the subform's functions with a "For each" cycle...
Any ideas?

Thanks in advance
 
M

Marshall Barton

Tiago said:
I'm using a form that includes many subforms.
What I would like to do is to update the subform's functions after changing
a value in a combobox that is in the mainform.
To do that I would like to retrieve the name of all subforms, so I can call
the subform's functions with a "For each" cycle...


I think this is the kind of thing you're looking for:

For Each ctl In Me.Controls
If ctl.ControlType = acSubFOrm THem
result = ctl.Form.function(args)
End If
Next ctl

Make sure the functions are declared as Public.
 
J

John Nurick

Pseudocode:

For Each C in MyForm.Controls
If C.Type = acSubform Then
With C.Form
do stuff
End With
End If
Next
 
T

Tiago Pinto

Thanks guys....

That did the trick...




John Nurick said:
Pseudocode:

For Each C in MyForm.Controls
If C.Type = acSubform Then
With C.Form
do stuff
End With
End If
Next
 

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