Toggling Subforms -is there an easier way?

qweeqweg

Member
Local time
Today, 07:02
Joined
Dec 12, 2019
Messages
33
My Friends..
I would like a form with a sidebar of buttons on the left, adjacent to a subform on the right.
Each button is to open a different subform.
Each subform must open in the exact same spot

No doubt you have all seen this format a hundred times; buttons on the left, toggling a view on the right.

My current approach: See attached

My main form has the buttons lined up on the left, and to the right, I have inserted 6 subforms; one precisely atop of the other.
I have set the visibility of the subforms to 'False' in the main form's On Open Event.
I have manipulated the visibility of the forms accordingly within each button action. (Huge PITA)

This all works nicely.. but there has GOT to be an easier way. Can anyone volunteer a less cumbersome method?

Very much obliged for your time.
 

Attachments

  • ToggleForm.png
    ToggleForm.png
    26.4 KB · Views: 121
Hi. Have you tried using a Navigation Form? Just a thought...
 
Maybe I do not understand how you have this set up, but this looks like one line of code to me. Cannot imagine this is hard. You have two subforms, one on the left and one on the right. When you click a button on the subform in the left your code is simply
me.parent.subform2ControlName.sourceObject = "FormName"
 
Thank you DBguy.
I'm not certain what that is. I'll google it up.
 
Thank you MajP..
Im teaching myself VBA and this particular scenario is a new challenge for me. Hiding the forms was the only way I could construct this with my limited VBA skills.

Regarding your recommendation- me.parent.subform2ControlName.sourceObject = "FormName"
What would 'subform2ControlName' be? I guess I need more instruction to understand what your code is doing.
 
Check out this link. Good luck!
Oh Yes.. I have one of these. ( I know this as a 'Switchboard'.) It occured to me that if I can do what Im after with this post, I won't need a navigation page (switchboard). My forms are small, and toggling between them would be easier for the user. Thanks though! Much obliged.
 
I assumed this is your setup
 

Attachments

Oh Yes.. I have one of these. ( I know this as a 'Switchboard'.) It occured to me that if I can do what Im after with this post, I won't need a navigation page (switchboard). My forms are small, and toggling between them would be easier for the user. Thanks though! Much obliged.
Ah, okay. It's there though as an option, in case you change you mind. Good luck!
 
I assumed this is your setup

OH! I totally get it now! Thanks so much, MajP. I appreciate the lesson. This is exactly what I was hoping for, and helps in more ways than just what I'm doing here. I little more light is shining on the machinery now. Very much obliged, sir.
Kind regards.
 
Did they not teach you in the AF to work smarter not harder?😀
 
The Navigation form can be difficult. If you only EVER need one form loaded at a time, the best solution is to use a single subform control. Then use your button's click events to change the SourceObject property to the form you want to load.

Me.sfrmctl.SourceObject = "sfrmMyform1"
 

Users who are viewing this thread

Back
Top Bottom