Multiple Subforms

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form with a subform linked to it (Subform displays child records...)
Now I want to be able to check a box and substitute a different set of
children. Main form represents vendors, subforms need to be addresses,
insurance records, and contract data respectively. I want to detect that an
option button choice, and make the apprpriate subform active.

Well, the first subform works fine, but how do I set up a second form to
have the correct parent links and child links, etc. Those properties don't
show up if I create the form independently. But if I create it as another
subform within the main form, how do I get it properly spaced and placed at
design time?

Just get me started....
 
I have a form with a subform linked to it (Subform displays child records...)
Now I want to be able to check a box and substitute a different set of
children. Main form represents vendors, subforms need to be addresses,
insurance records, and contract data respectively. I want to detect that an
option button choice, and make the apprpriate subform active.

By far the simplest way to do this is to put a Tab Control on your
form; put one subform on each page of the tab control.

If you really want to do this with a checkbox or option group, use the
control's AfterUpdate event to change the SourceObject property of the
subform control:

Private Sub optMyOptiongroup_AfterUpdate()
Select Case optMyOptiongroup
Case 1
Me.subMySubform.SourceObject = "frmAddresses"
Case 2
Me.subMySubform.SourceObject = "frmInsurance"
<etc>
End Select
End Sub

John W. Vinson[MVP]
 
So, you're suggesting the tabbed form be a sub to the main form?

No. I'm suggesting that you put a Tab Control on the main form and put
a Subform Control on each page of the Tab Control.

Note that a Tab Control isn't a form - it's just a tool that lets you
allocate screen real estate.

John W. Vinson[MVP]
 
Back
Top