MS Access...check for any open forms

KP_SoCal
KP_SoCal used Ask the Experts™
on
I'm running MS Access 2016, and I'm looking for a function that will do the following when closing a form in my database.

1. After active form closes, check if there are any other open forms
2. If there are no other open forms, fire a command such as
MsgBox "All forms have been closed."

Open in new window


I appreciate any expert advice you can provide! =)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Owner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010
Commented:
Public Function fnAreAllFormsAreClosed () as boolean

    fnAreAllFormsClosed = forms.count = 0
    if Forms.count = 0 then msgbox "All forms have been closed

End Function

Open in new window


Then you can use the Form_Close event of each form to call this subroutine.

Author

Commented:
Precisely what I needed! Thanks so much!!!
Dale FyeOwner, Dev-Soln LLC
Most Valuable Expert 2014
Top Expert 2010

Commented:
glad I could help

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial