Export (0) Print
Expand All

Forms Collection [Access 2003 VBA Language Reference]

Office 2003
Application
Forms
Form
Multiple objects

The Forms collection contains all of the currently open forms in a Microsoft Access database.

Using the Forms Collection

Use the Forms collection in Visual Basic or in an expression to refer to forms that are currently open. For example, you can enumerate the Forms collection to set or return the values of properties of individual forms in the collection.

For Each...Next

You can refer to an individual Form object in the Forms collection either by referring to the form by name, or by referring to its index within the collection. If you want to refer to a specific form in the Forms collection, it's better to refer to the form by name because a form's collection index may change.

The Forms collection is indexed beginning with zero. If you refer to a form by its index, the first form opened is Forms(0), the second form opened is Forms(1), and so on. If you opened Form1 and then opened Form2, Form2 would be referenced in the Forms collection by its index as Forms(1). If you then closed Form1, Form2 would be referenced in the Forms collection by its index as Forms(0).

Note   To list all forms in the database, whether open or closed, enumerate the AllForms collection of the CurrentProject object. You can then use the Name property of each individual AccessObject object to return the name of a form.

You can't add or delete a Form object from the Forms collection.



Parent Objects | Application

Child Objects | Control | Controls | Form | Module | Properties | Section



Show:
© 2015 Microsoft