Glad you managed to get it to work, just to clarify for future reference though for anyone else reading this.
You need put this in a module
Public Function IsLoaded(strFormName As String) As Boolean
sFormOpen = (SysCmd(acSysCmdGetObjectState, acForm, strFormName) = acObjStateOpen)
End...