[ Team LiB ] |
![]() ![]() |
Preparing an Application to Be Self-DocumentingAccess ships with an excellent tool to assist with the process of documenting a database: the Documenter. Although you can use this tool without any special preparation on your part, a little bit of work as you build the components of a database can go a long way toward enhancing the value of the Documenter's output. Documenting TablesThe Documenter prints all field and table descriptions that you enter in the design of a table. Figure 21.1 shows a table in Design view. Notice the descriptions for the ClientID and StateProvince fields. These descriptions provide additional information that is not readily obvious from looking at the field names. The Table Properties window also contains a Description property. The Documenter includes this property when you print a table's documentation. Figure 21.1. Documenting a table by including descriptions of each field and using the Table Properties dialog box.Entering a table description also assists you and the users of your database work with the tables in the database. Figure 21.2 shows the Database window after table descriptions have been entered. The description of each table then appears in the Database window. Figure 21.2. The Database window, with table descriptions.
Documenting QueriesJust as you can enhance the output that the Documenter provides for tables, you can enhance the output the Documenter provides for queries. Figure 21.3 shows the Query Properties, in which the Description property has a detailed description of the purpose of the query. Figure 21.4 shows the description of an individual column in a query. Access includes both the query and field descriptions in the output provided by the Documenter. Figure 21.3. Documenting a query by using the Description property.Figure 21.4. Documenting a column in a query.Documenting FormsDocumentation is not limited to table and query objects. A form also has a Description property. You cannot access it from the Design view of the form, though. To view or modify the Description property of a form, follow these steps:
Documenting ReportsYou document reports in exactly the same way you document forms. Reports have a Description property that you must enter in the Properties dialog box. Remember that to access this dialog box, you right-click the object in the Database window and choose Properties from the context menu. Documenting MacrosYou can document macros in significantly more detail than you can document forms and reports. You can document each individual line of a macro, as shown in Figure 21.7. Not only does this provide documentation in the Documenter, but also, macro comments become code comments when you convert a macro to a VBA module. In addition to documenting each line of a macro, you can add a description to the macro. As with forms and reports, to accomplish this, you right-click the macro in the Database window and choose Properties from the context menu. Figure 21.7. Documenting a macro by including a description of what each line of the macro does.Documenting ModulesI cannot emphasize enough how important it is to document modules with comments. Of course, you do not need to document every line of code. I document all areas of my code that I feel are not self-explanatory. Comments help me when I revisit the code to make modifications and enhancements. They also assist anyone who is responsible for maintaining my code. Finally, they provide the user with documentation about what the application is doing. Comments print with code modules, as shown later in this hour in the section "Using the Documenter." As with the other objects, you can right-click a module in the Database window and choose Properties from the context menu to assign a description to it. Using Database Properties to Document an Overall DatabaseIn addition to enabling you to assign descriptions to the objects in the database, Microsoft Access enables you to document the database as a whole. You do this by filling in the information included in the Database Properties window. To access a database's properties, you choose File | Database Properties or right-click the title bar of the Database window and choose Database Properties from the context menu. The Database Properties dialog box appears, as shown in Figure 21.8. As you can see, this dialog box has five tabs: General, Summary, Statistics, Contents, and Custom. Figure 21.8. The General tab of the Database Properties window.The tabs in the Database Properties dialog box do the following:
|
[ Team LiB ] |
![]() ![]() |