Toggling Subforms -is there an easier way? (1 Viewer)

qweeqweg

Member
Local time
Today, 13:33
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: 82

theDBguy

I’m here to help
Staff member
Local time
Today, 11:33
Joined
Oct 29, 2018
Messages
21,496
Hi. Have you tried using a Navigation Form? Just a thought...
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:33
Joined
May 21, 2018
Messages
8,555
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"
 

qweeqweg

Member
Local time
Today, 13:33
Joined
Dec 12, 2019
Messages
33
Thank you DBguy.
I'm not certain what that is. I'll google it up.
 

qweeqweg

Member
Local time
Today, 13:33
Joined
Dec 12, 2019
Messages
33
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.
 

qweeqweg

Member
Local time
Today, 13:33
Joined
Dec 12, 2019
Messages
33
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.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:33
Joined
May 21, 2018
Messages
8,555
I assumed this is your setup
 

Attachments

  • TestSubForms.zip
    20.7 KB · Views: 97

theDBguy

I’m here to help
Staff member
Local time
Today, 11:33
Joined
Oct 29, 2018
Messages
21,496
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!
 

qweeqweg

Member
Local time
Today, 13:33
Joined
Dec 12, 2019
Messages
33
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.
 

MajP

You've got your good things, and you've got mine.
Local time
Today, 14:33
Joined
May 21, 2018
Messages
8,555
Did they not teach you in the AF to work smarter not harder?😀
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 14:33
Joined
Feb 19, 2002
Messages
43,365
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

Top Bottom