iterating through subforms

I’m setting up a macro to assist with cascading listboxes in forms. I’m trying to keep it as generic as possible, using the event object to identify the main form. It will “Save Changes” to the record in the main form, which is tied to a “filter table”, and reload the subform(s) so that their listboxes(set by a queries that reference the filter table) are updated. How do I ensure that the reload is executed on all subforms? Should I be creating a subforms object and iterating through the subforms, or am I over-complicating it?


Based upon statements in question, it seems safest to simply reload each sub form.

Would not think you have many sub forms or the form may become to busy for practical usage.

Great, thanks! So, if I’m keeping the macro generic and not form-specific, is there a good way to reload all subforms of the form the event that triggers the macro? (I’m envisioning creating an object for all subforms and then iterating through it.

As stated in the answer don’t see you having many sub forms (you don’t mention).

No sense iterating through anything. Just reload each - one line per. Not clear if you really need to reload all. Just ones affected by list box modifications.

Right, but setting up a line for each subform would require me to know the name of each subform, and since I’m not writing this macro for a specific form, but trying to keep it form-generic, I don’t. Again, thanks for your time. I’ve noticed that you’ve responded to practically every question I’ve asked.

Don’t know of a method to do this. Personally don’t see any benefit either.


Have had a chance to look at your request. It is unique as the great majority of issues will automatically refresh sub forms but yours possibly does not. Way too many details needed to determine all you may need.

As for the request (I still see no benefit in using something like this) when you get the main form there is a property Count which notes how many items on that form. Using that, you can get by index each item and an item will have the property of ServiceName be set to if a form.

If I had something similar I think going to next record and back again (which then reloads the sub forms) may be a better direction.