Avatar of Joy Gomez
Joy Gomez
 asked on

Subform visibility


I have a main form (Main_Menu) and 2 sub forms (Main_DLMP and Main_DeptView). In the main menu I have 2 labels that act as menu.  I have click events on both these labels.  I want to make one visible, and the other not visible.  But I struggling with this.  These are the 2 events I have for each of the labels in my main form.

 This is the event on the first label. As default Main_DLMP visibility is set to True and DLMP_DeptView is set to False.
    Forms![Main_Menu]![Main_DLMP].Form.Visible = True
    Forms![Main_Menu]![Main_DeptView].Form.Visible = False

This is the event on the second lablel
    Forms![Main_Menu]![Main_DeptView].Form.Visible = True
    Forms![Main_Menu]![Main_DLMP].Form.Visible = False
I am getting an error on the second label... Cannot set focus.
Microsoft Access

Avatar of undefined
Last Comment
Joy Gomez

8/22/2022 - Mon
Anders Ebro (Microsoft MVP)

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
John Tsioumpris

Normally Labels don't need Focus...
What you probably need is that the Labels are unassociated with any controls. To check it just right clicks -->Properties..check if Events are displayed...if its blank ..then the easy way is to make a copy of the Label delete the old Label..rename the New label to match the old name and you should be fine
Also for Visiility
Me.Lbl1.Visible = Not Me.Lbl2.Visible

Open in new window

John Tsioumpris

Probably i confused Labels with Subforms..
Ok np
On the click event of Labels...
Form_NameOfSubForm1.Visible = Not Form_NameOfSubForm2.Visible

Open in new window

Joy Gomez

Thank you Anders... worked great!

John... thanks for your continuous support.
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy