=> SubForm on a Tab Control page

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
 
R

Roger Carlson

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.
 
P

Pavel Romashkin

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top