0
votes

I have a tab control with a number of pages, each with 1 or 2 sub forms. One of the page/subforms affects the visibility of most of the other pages and their corresponding sub forms. If someone adds a record to this one sub form, I set that record's corresponding tab control page to visible.

i also need to requery the subform on that page. My challenge is, I don't know how to identify in the middle of the code, without having to explicitly hard code an if or case statement to go through every page, and spell out the subform on that page.

Is there a way, if I already have the subform page identified in a record set loop, to check for a form control on that page, and for each one found, requery it's recordsource?

Thank you.

1

1 Answers

0
votes

Solved.

For Each ctl In Forms!frmformname.tbTabName.Pages(recordsetname.Fields("pagecontrolfieldname")).Controls
                With ctl
                    Select Case .ControlType
                    Case acSubform
                        ctl.Form.Requery
                    End Select
                End With
            Next ctl

Now I just need to figure out how to limit the type combo box on the controlling subform, so that it doesn't show values that already exist in the main records, sub record table.

I will post that separately.