Closing forms in an event procedure

  • Thread starter Thread starter Guest
  • Start date Start date
PRH said:
Can anyone tell me the correct code for closing all open forms using an event
procedure?

Sub CloseAllForms()

Dim i As Integer

For i = Forms.Count - 1 To 0 Step -1
DoCmd.Close acForm, Forms(i).Name
Next i

End Sub
 
Thanks for the advice. I should have said that I want to leave the active
form open. How would this change the code?
 
Back
Top