=> SubForm on a Tab Control page

  • Thread starter Thread starter Rhonda Fischer
  • Start date Start date
R

Rhonda Fischer

Hello,

I have created a tab control page and put a subform
on it. I would like to put a button on this subform
which will open a second form and which I would like
to replace the first subform, to become the sub
form of the tab control page. Can I do this?

ie.
Subform: frmDeliveries has cmdbtn: DeliveryDetails
replaces about subform to become the main subform
of the tab control Page.

Thank you very much for your thoughts

Cheerio
Rhonda
 
Put both subform controls on your form. Put SubformControl1 directly on top
of SubformControl2. Make SubformControl2 invisible "visible=No". Create a
button with "Show Subform 2" as the Caption and have the following code in
the OnClick event:

If cmdMyButton.Caption = "Show Subform 2" then
Me.SubformControl2.Visible = True
Me.SubformControl1.Visible = False
Me.cmdMyButton.Caption = "Show Subform 1"
Else
Me.SubformControl2.Visible = False
Me.SubformControl1.Visible = True
Me.cmdMyButton.Caption = "Show Subform 2"
End If

This will toggle the forms so that only one is visible at a time.
 
I would not do this because the hidden sf will also refresh and take
extra time on every current event of the main form. It can be
substantial is the underlying dataset is large. I would simply replace
the SourceObject of the existing subform control and refresh only the
needed subform.
Cheers,
Pavel
 
Back
Top