Switching Visibility of Subforms

NeroMaj

Registered User.
Local time
Today, 09:42
Joined
Sep 13, 2010
Messages
34
I have a main form acting as a container, which is holding a number of other forms.

Three of these subforms are overlapping on the main form, and I want to use VBA to show the form necessary when certain actions are performed, such as a command button clicked or a link clicked, etc...

Right now I am using the following method

Code:
Private Sub CommandButton_Click()
Docmd.Close acForm, CurrentForm.Name, acSaveYes
Form_FormToShow.Visible = True       
End Sub

This works for two of the subforms, but when one of the subforms opens, I cant get it to disspear using the same method that I used to make it appear.

I believe this has something to do with the layering of the subforms on top of each other. It seems that the subform that is in "Front" in design view stays in "Front" in normal View after it is loaded. Is there anyway to get around this?
 
Don't use this:

Form_FormToShow.Visible = True

syntax

You should be hiding or showing the subform CONTROL (not the form) on the main form.
 
How about a tab control instead? Put each subform on to a separate page on the control and the user simply selects the page they wish rather than trying to hide subforms.
 

Users who are viewing this thread

Back
Top Bottom