"swingingming" <mi******@gmail.com> wrote in message
news:11*********************@o13g2000cwo.googlegro ups.com...
If Form A opens Form B with a filter set based a value on Form A. Then
I closed Form A, in navigating Form B, I got some error says Access can
not find Form A.
How can I detect this programatically in the code?
Thanks,
ming
You need to find out if it is open, rather than if it simply exists, don't
you? If you put this in a module:
Public Function IsFormLoaded(strName As String)
IsFormLoaded = (SysCmd(acSysCmdGetObjectState, acForm, strName) <> 0)
End Function
You can then write:
If IsFormLoaded("FormA") Then
' Do your stuff here
Else
MsgBox "FormA isn't open"
End If