DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Close All Forms In Access
Sometimes, it's necessary to close all forms in a single procedure:
Function CloseAllForms() 'It will close all forms before opening the new form (if required) Dim obj As Object Dim strName As String For Each obj In Application.CurrentProject.AllForms DoCmd.Close acForm, obj.name, acSaveYes Next obj End Function
Close all forms - except one particular screen:
Function CloseAllForms() Dim obj As Object Dim strName As String For Each obj In Application.CurrentProject.AllForms If obj.Name <> "Your Form" Then DoCmd.Close acForm, obj.name, acSaveYes End if Next obj End Function





