Heenan, Lambert
Lambert.Heenan at AIG.com
Wed Jan 18 08:42:36 CST 2006
Could this be a problem?... "For lngF = Forms.Count - 1 To 1 Step -1" if form n is closed, does Forms.Count not simultaneously decrease? In which case might the loop miss an open form? An alternative would be Sub CloseEm(strKeepOpen as String) Dim f as Form For Each f In Forms If f.Name <> strKeepOpen Then DoCmd.Close acForm. F.Name, acSaveYes Next f End Sub Lambert -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Gustav Brock Sent: Wednesday, January 18, 2006 9:22 AM To: accessd at databaseadvisors.com Subject: Re: [AccessD] ...close open forms Hi William How about: ' Close all forms except this first opened form. For lngF = Forms.Count - 1 To 1 Step -1 DoCmd.Close acForm, Forms(lngF).Name, acSaveYes Next /gustav >>> wdhindman at bellsouth.net 18-01-2006 15:01:48 >>> ...I need to close any open forms ...other than designated forms ...and save their data ...before opening a called form ...from the called form. ...ie call a form open from a switchboard ...the called form checks for any other forms open, other than the sb, and closes them, saving their data, before it opens. William -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com