Is there any VBA code to check If any form is loaded?
The function below should return "True" if any form is open.
Code:
'---------------------------------------------------------------------------------------
' Procedure : fnFormIsOpen
' Author : Bob Fitz
' Date : 03/09/2012
' Purpose :
'---------------------------------------------------------------------------------------
'
Public Function fnFormIsOpen() As Boolean
On Error GoTo Err_fnFormIsOpen_Error
Dim frm As AccessObject
For Each frm In CurrentProject.AllForms
If frm.IsLoaded Then
fnFormIsOpen = True
End If
Next
Exit_ErrorHandler:
Exit Function
Err_fnFormIsOpen_Error:
MsgBox "Error " & Err.Number & " " & Err.Description
Resume Exit_ErrorHandler
End Function