Closing forms in an event procedure

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Can anyone tell me the correct code for closing all open forms using an event
procedure?
 
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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top