is my subForm loaded?

W

Warrio

Hello!

How is it possible to see if a subform is loaded ?
because depending on the data, my subform might be displayed or not..

I've tried
if CurrentProject.AllForms("MyForm").IsLoaded then
....
Endif

but the result of this is always at False

Thanks for any suggestion
 
A

Allen Browne

No, subforms are not loaded in their own right.

You probably know which parent forms may contain this subform, so you could
loop through them and see. If you delay-load your subforms, you can check
the SourceObject property of the subform control to see if/which is loaded.

If necessary, it would be possible to loop through each member of the Forms
collection, loop through the Controls of each to find those where
ControlType = acSubform, and check the SourceObject. That could be done
recursively to search the sub-subforms as well.
 
W

Warrio

Thanks! nice idea.. it works

Allen Browne said:
No, subforms are not loaded in their own right.

You probably know which parent forms may contain this subform, so you could
loop through them and see. If you delay-load your subforms, you can check
the SourceObject property of the subform control to see if/which is loaded.

If necessary, it would be possible to loop through each member of the Forms
collection, loop through the Controls of each to find those where
ControlType = acSubform, and check the SourceObject. That could be done
recursively to search the sub-subforms as well.
 

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