PDA

View Full Version : How do you check for a Form's status




jrunyon
02-26-2004, 08:04 AM
I want to perform a check to see if a form is opened, without opening it. I tried the following code below, but it actually opens the form and I don't want to open if it isn't opened.

Case "FPolRetrvl"
If FrmP1ImgRtv.Visible = False Then
If FrmImgRtv.WindowState = 1 Then
FrmImgRtv.WindowState = 0
Else
FrmImgRtv.Show
End If
Else
RetVal = MsgBox("FMPA Image Retrieval cannot be opened with Priority1 Image Retrieval Opened. Do you want me to close Priority1 Image Retrieval?", vbYesNo, "Unable to Grant Request!")
If RetVal = 6 Then
Unload FrmP1ImgRtv
FrmImgRtv.Show
Else
Exit Sub
End If
End If




illuminati
03-17-2004, 10:47 PM
Function fIsLoaded(ByVal strFormName As String) As Integer
If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 then
If Forms(strFormName).CurrentView <> 0 Then
fIsLoaded = True
End If
End If
End Function

And here's another way:

Public Function IsLoaded(MyFormName As String) As Boolean
Dim i As Integer
IsLoaded = False
For i = 0 To Forms.Count - 1
If Forms(i).FormName = MyFormName Then
IsLoaded = True
Exit Function
' Quit function once form has been found.
End If
Next i
End Function

jrunyon
03-18-2004, 06:48 AM
Thanks for the help!