Open Forms

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

Guest

Hello everyone,

I have a form which is called from two other ("parent") forms. Not both
"parent" forms are open at any given time. Is there a way to know which
"parent" form called the "child" form?

If not, Is there a way to know whether a form is open?

Thanks a lot,

Marios
 
Marios said:
Hello everyone,

I have a form which is called from two other ("parent") forms. Not both
"parent" forms are open at any given time. Is there a way to know which
"parent" form called the "child" form?

If not, Is there a way to know whether a form is open?

Thanks a lot,

Marios

Use the OpenArgs property when calling the form:

DoCmd.OpenForm "frmMyForm", , , , , , Me.Name

In the called form, get the name of the calling form:

Dim strCallingForm As String
strCallingForm = Me.OpenArgs

To determine if a specific form is open, use this:

Public Function libIsFormLoaded(ByVal strFormName As String) As Boolean
' Returns true if the specified form is open in Form View
Const cObjStateClosed = 0
Const cDesignView = 0

If SysCmd(acSysCmdGetObjectState, acForm, strFormName) Then
If Forms(strFormName).CurrentView <> cDesignView Then
libIsFormLoaded = True
End If
End If
End Function

Call the function like this:

If libIsFormLoaded("frmMyFormName") Then ...

HTH - Keith.
www.keithwilby.com
 
Back
Top