|
|
От: | Extraterrestrial | |
| Дата: | 12.01.06 14:52 | ||
| Оценка: | |||
OLE>A Module object refers to a standard module or a class module.
OLE>Using the Module Object
OLE>Microsoft Access includes class modules that are not associated with any object, and form modules and report modules, which are associated with a form or report.
OLE>To determine whether a Module object represents a standard module or a class module from code, check the Module object's Type property.
OLE>The Modules collection contains all open Module objects, regardless of their type. Modules in the Modules collection can be compiled or uncompiled.
OLE>To return a reference to a particular standard or class Module object in the Modules collection, use any of the following syntax forms.
OLE>Syntax Description
OLE>Modules!modulename The modulename argument is the name of the Module object.
OLE>Modules("modulename") The modulename argument is the name of the Module object.
OLE>Modules(index) The index argument is the numeric position of the object within the collection.
OLE>The following example returns a reference to a standard Module object and assigns it to an object variable:
OLE>Dim mdl As Module
OLE>Set mdl = Modules![Utility Functions]
OLE>Note that the brackets enclosing the name of the Module object are necessary only if the name of the Module includes spaces.
OLE>The next example returns a reference to a form Module object and assigns it to an object variable:
OLE>Dim mdl As Module
OLE>Set mdl = Modules!Form_Employees
OLE>To refer to a specific form or report module, you can also use the Form or Report object's Module property:
OLE>Forms!formname.Module
OLE>The following example also returns a reference to the Module object associated with an Employees form and assigns it to an object variable:
OLE>Dim mdl As Module
OLE>Set mdl = Forms!Employees.Module
OLE>Once you've returned a reference to a Module object, you can set or read its properties and apply its methods.