How to hide multiple forms using .visible =false statement

H

Housemate

Hi,

I have a problem with a form that can be opened from 3 possible forms.
At the moment whenever the form opens or closes from just one form (The
Admin Menu) I use the following code:

Private Sub Form_Close()
Forms![frm_AdminMenu].Visible = True
End Sub

Private Sub Form_Open(Cancel As Integer)
Forms![frm_AdminMenu].Visible = False
End Sub

Can this be amended so that if the same form is opened from one of two
other forms (i.e: frm_EditProperty or frm_NewProperty) as well as the
AdminMenu form, whichever one is open the [.Visible = False] statement
comes into play instead? Something like:

Private Sub Form_Open(Cancel As Integer)
If (Forms![frm_EditProperty].IsOpen) Then
Forms![frm_EditProperty].Visible = False
End If
If (Forms![frm_AdminMenu].IsOpen) Then Forms![frm_AdminMenu].Visible =
False
End If
If (Forms![frm_NewProperty].IsOpen) Then
Forms![frm_NewProperty].Visible = False
End If
End Sub

Also, I understand the .IsLoaded function could play a part in getting
this to work but didn't have any luck!

Please, please help....it would be greatly appreciated!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top