Duplicate forms

P

Pat Backowski

Hi Everyone,
I want to ensure that two copies of a form are not running at the same time
- I don't care of its the first or the second that runs, but not both, or
subsequent.

As always, I thank you in advance in for kind consideration.
Regards,
Pat.
 
B

B. Edwards

In the form open event of one form check to see if the other form is open.
If it is then cancel the Open event:

In frmForm2 open event:

Private Sub Form_Open(Cancel As Integer)
If CurrentProject.AllForms("frmForm1").IsLoaded Then
Cancel = True
End If
End Sub

In frmForm1 open event:

Private Sub Form_Open(Cancel As Integer)
If CurrentProject.AllForms("frmForm2").IsLoaded Then
Cancel = True
End If
End Sub
 
Top