Special Edition Using Microsoft Office Access 2003
Each Form and Report object in the current database that has a class module appears in the Classes list when you select the project name of the current database in the Project/Library (upper) drop-down list of Object Browser. By default, the project name for an Access database is the file name of the database without a file extension; thus, the project name for Northwind.mdb is Northwind. The default <globals> object displays all the procedures in conventional Access modules of the current database in the right-hand Members Of '< globals>' list. These procedures also appear in Members Of 'ModuleName' entries for each module in the project. Tip
Figure 28.5. Selecting the OpenForms function in Object Browser displays a replica of its header in the bottom pane. If the function header doesn't include a scope prefix, Object Browser adds Public.
Note VBA 6.0 lets you define your own classes and write custom class modules. Custom class modules give you the opportunity to define a set of properties and methods for the object class you create. Custom class modules appear in Object Browser's Classes list, and the properties and methods you define appear in the Members Of 'ObjectName' list. Writing custom class modules is beyond the scope of this book.
The default reference to the Microsoft Access 11.0 Object library (Msacc.olb) enables programming of Access-specific objects, such as the DoCmd object described in the preceding section. To display Access-specific objects, select Access in Object Browser's Project/Library list. Scroll to and select the DoCmd object to display a list of its methods (see Figure 28.6). Object Browser's bottom pane displays the required and optional arguments of the method. Figure 28.6. The Access DoCmd object has many methods, but no properties. The TransferSQLDatab ase method lets you emulate the Tools, Database Utilities, Transfer Database menu command of Access Data Projects (ADP).
Figure 28.7. The General page of the Project Properties window lets you rename a project and add a description. The Protection page offers the option to hide your VBA code from others and password-protect the code.
|