Using Command Buttons to show/hide subforms on a Form

I have a form, called FormA, with subforms: SubFormB1 and SubFormB2.  Here is what I would like to do:

I would like to have two buttons, ButtonB1 and ButtonB2 on the FormA.  When pressed, they would open the respective Subforms.  So, when I push ButtonB1, SubformB1 would open.

The only catch is: these buttons reside on FormA always.  The subforms open on FormA.  So the buttons would open and hide the other subform.  

To possible give a better visual, I imagine this to be (somewhat) like a webpage (FormA) with navigation links along the side (ButtonB1 and ButtonB2) that open contens in a frame (SubFormB1 and SubFormB2) without changing the overall page itself (FormA)

Any help is greatly greatly appreciated.
Who is Participating?
peter57rConnect With a Mentor Commented:
If you place the subforms one on top of the other then you can make them visible or not.
You must use the name of subform container control in each case. That might be the same as the name of the subform but it could be different, so you have to check.

me.containercontrolB.visible = false
me.containercontrolA.visible = true

me.containercontrolA.visible = False
me.containercontrolB.visible = True
mcollins354Author Commented:
Excellent!  This is exactly what I needed and it worked great.  Thank you!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.