Form closed when another one is open (1 Viewer)

M

Monica

Guest
I have built a DB with 3 different forms how do get one form to close when I open a new one without click on the X to close it. I was told by a co-worker that this could be done and he was going to show me and was in an accident and will be out at least 3 weeks. Any suggestions or ideas.
 

Mitch

Registered User.
Local time
Today, 10:44
Joined
May 23, 2000
Messages
31
In you event which opens the new form add a new line of code below the open statement -

Docmd.close acForm, "frmYourFormName"

HTH

Mitch.
 

Travis

Registered User.
Local time
Today, 02:44
Joined
Dec 17, 1999
Messages
1,332
try this, add the following code to the Form_Open events of your forms.

Private Sub Form_Open(Cancel As Integer)
Dim frm As Form
For Each frm In Forms
If frm.Name <> Me.Name Then DoCmd.Close acForm, frm.Name
Next frm

End Sub


This will close all forms that are open except the currently being opened form.
 

Users who are viewing this thread

Top Bottom