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
When you select a Form or Report object, items representing properties of the Form or Report object and each of the control objects added to the Form or Report object appear in the Members Of 'ObjectName' list. Each procedure also appears (in bold type) in the list. Figure 28.5 shows the list item for OpenForms function; the syntax required to call the function appears in the bottom pane. Object Browser adds the Public prefix to functions and subprocedures that aren't declared Private. If you double-click a subprocedure or function item, the editor window displays its code. 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.
|