Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command to close all open windows? 2

Status
Not open for further replies.

PortyAL

Technical User
May 13, 2005
126
GB
Hi

Just wondering if is there is a VBA command that will automatically close all open forms and reports etc. (including hidden ones), but leaving the main database window open?

Thanks

AL
 
You could build a function easily enough using the forms and reports collection. This could then be assign to a hot key with an AutoKeys macro, if required.
 
Thanks.

I've never used collections before so I'm a bit unsure as to how to go about this.

AL
 
A starting point:
Code:
For i = Forms.Count - 1 To 0 Step -1
  DoCmd.Close acForm, Forms(i).Name
Next


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top