PDA

View Full Version : Solved: Finally: Communicate between main and dynamically loaded subforms.



mud2
03-01-2009, 09:41 PM
It pays to be stubborn...
I have several tables, and a form for each. I want to view/edit the data in these tables while using its form. I want to have ONE form with record navigation buttons. I must "link" these navigation buttons to the dynamically loaded form.
Solution(?)
An opening form with a combobox that allows choice of which form to view.
A "navigation" Form with navigation buttons.
A blank form (here) called SubForm1
In design mode, drag the blank form into the navigation form.
In the VBA under the navigation form, in Sub Form_Load()


Private Sub Form_Load()
With Me.SubForm1
.SourceObject = GetFormNames()
.LinkChildFields = "Name"
.LinkMasterFields = "Name"
End With

...
...
End Sub

GetFormNames() gets the form wanted...from the module
"Name" is the name of a field in each form to be dynamically loaded. If there is no "Name", adapt to a field that IS in the wanted form.

It does work!
Now I can get back to the project I've been working on for 3 years...If I can only remember what I WAS able to do!