Forms with multiple subforms

  • Thread starter Thread starter Eric F
  • Start date Start date
E

Eric F

I have a "Main Form" (not switchboard) that would have contact information
and would like to have a subform below. What I would like is some hyperlinks
that would change the subform. Clicking on the different links would change
and replace the subform. So I would have numerous subforms that would cycle
through depending on what link the user clicked.

My thoughts are that there needs to be some code that would reference a
table containing all the subforms. Then assign the links a specific number
that would refer to the subform. What I dont know is if there is a way to
replace subforms in a specific area.

Any thoughts would be greatly appreciated

~Eric
 
Using a tabbed form is very good for some uses. But if you need to present
one subform while not showing the others dynamically try opening all of the
subforms in the same location and making them invisible. Then write some
code behind your buttons what will make the appropriate forms visible or
invisible. It works better than trying to change the source of a form.

Tom

I use the code below to switch subforms depending on which industry is
chosen in a combo box

-----------
Private Sub INDUSTRY_AfterUpdate()

Me.PowerProjectSubform.Visible = False
Me.MiningProjectSubform.Visible = False
Me.StructuralProjectSubform.Visible = False
Me.TransportationProjectSubform.Visible = False

If Me.INDUSTRY = "POWER" Then
Me.PowerProjectSubform.Visible = True

ElseIf Me.INDUSTRY = "MINING" Then
Me.MiningProjectSubform.Visible = True

ElseIf Me.INDUSTRY = "structural" Then
Me.StructuralProjectSubform.Visible = True

ElseIf Me.INDUSTRY = "transportation" Then
Me.TransportationProjectSubform.Visible = True

End If


End Sub
 
I am not an expert just a user but I did the same thing using macros that
will open or close each subform when the link got focus or lost focus.
In my case tabs were not a solution because I had more than 16 different
subforms to open.
I used a Main form with Options buttons and when each option is clicked it
opens a subform, and when you click on another option the first subform will
close and the second subform will open.
I hope this will help. Is another approaches but works very well.

SC
 
Back
Top