[AccessD] A2K: Loop through Forms and close open forms

Glen McWilliams glen_mcwilliams at msn.com
Mon May 31 20:10:13 CDT 2004


Darren

Here is a snippet from my shut-down module, which walks through the Forms 
collection closing any open form:

'****Begin Code****
   ' Close any open Forms.
   ' Loop through the Forms collection.
   For Each objTmp In dbsCurrent.Containers("Forms").Documents
      ' Assign the name propery value, for each Form, to the Name string 
variable.
      strName = objTmp.Name
      If gfnIsObjectOpenBln(acForm, _
                            strName) Then
         ' Use the Close method of the DoCmd object to close the specified 
object.
         DoCmd.Close acForm, strName
      End If
   ' Repeat the foregoing block of statements for the next element in the 
specified
   ' collection.
   Next objTmp
'****End Code****


>From: "Darren DICK" <d.dick at uws.edu.au>
>Reply-To: Access Developers discussion and problem 
>solving<accessd at databaseadvisors.com>
>To: "AccessD List" <AccessD at databaseadvisors.com>
>Subject: [AccessD] A2K: Loop through Forms and close open forms
>Date: Tue, 1 Jun 2004 09:46:57 +1000
>
>Hello all
>
>I want to loop through the Forms collection and close any form/forms that 
>is/are open.
>
>Any suggestions?
>
>Many thanks in advance
>
>Darren
>
>--
>_______________________________________________
>AccessD mailing list
>AccessD at databaseadvisors.com
>http://databaseadvisors.com/mailman/listinfo/accessd
>Website: http://www.databaseadvisors.com





More information about the AccessD mailing list