Open Form If Other Form is already Open

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi to all,

I want to open a form with an embedded query that has criteria referencing a
value in another form. I want to check before the form is Open/Load to be
sure that the other referrenced form is open.

I have tried this code on both Open event and Load event of the current form
and it doesn't work (the embedded query is being referenced before this
active form test is allowed to run).

'*******************************
Private Sub Form_Open(Cancel As Integer)
'*******************************
IS_Form_Active

If strYesNo = "YES" Then
Else
End
End If

End Sub

How can I run the above test before the embedded query is used?

Thanks for the Help
 
This example tests if Form1 is open, and blocks the opening of the form it
that is not the case:

Private Sub Form_Open(Cancel As Integer)
If CurrentProject.AllForms("Form1").IsLoaded Then
MsgBox "Yep: it's open."
Else
MsgBox "Open Form1 first."
Cancel = True
End If
End Sub

Requires Access 2000 or later.
 
hi Ross,
'*******************************
Private Sub Form_Open(Cancel As Integer)
'*******************************
IS_Form_Active

If strYesNo = "YES" Then
Else
End
End If

End Sub

How can I run the above test before the embedded query is used?
Use an unbound form. When test is positive assign your query to record
source of the form (Me.RecordSource = "QueryName").


mfG
--> stefan <--
 
Stefan

I was afraid that this might be the only way. If "IsLoaded" doesn't work,
then I will use that method.

Thank You
 
Back
Top