The information in this article applies to:
- Microsoft Access versions 1.0, 1.1
SUMMARY
This article provides an example of how to use the Object Analyzer
commands discussed in the article titled "Programming with the Object
Analyzer Engine and Utilities."
This article assumes that you are familiar with Access Basic and with
creating Microsoft Access applications using the programming tools
provided with Microsoft Access. For more information on Access Basic,
please refer to the "Introduction to Programming" manual.
MORE INFORMATION
As discussed in "Programming with the Object Analyzer Engine and
Utilities," you can take advantage of the Object Analyzer engine by using
the commands in the Object Analyzer module.
To create your own Database Analyzer, follow these steps.
Creating a Form
- Open the sample database NWIND.MDB and create a new form called Little
Analyzer.
- Add a text box control to the form. Change the ControlName
property to Name.
- Add an option group control called Options to the form.
- Add six toggle buttons to the Options option group and modify the
properties of the toggle buttons as described below:
Control Option Value Caption
--------------------------------------
First Button 1 Table
Second Button 2 Query
Third Button 3 Form
Fourth Button 4 Report
Fifth Button 5 Macro
Sixth Button 6 Module
- For the AfterUpdate property of the Options option group, specify
the following:
=AnalyzeIt(Name, Options)
- Save and close the form.
Creating a Module
- Open the sample database NWIND.MDB.
- Create a new module and type the following function:
Function AnalyzeIt (InName As String, InType As Integer)
' This function accepts the name of a Microsoft Access object
' and a number representing what type of object it is, then uses
' the Object Analyzer Dump commands to analyze the object.
DoCmd Hourglass True
Select Case InType
Case 1
DumpTableInfo "NWIND.MDB","@Table",InName,False
Case 2
DumpQueryInfo "NWIND.MDB","@QuerySQL","@Query",InName
Case 3
DumpFormOrReport "NWIND.MDB","@Form","@FCtrls",InName,True
Case 4
DumpFormOrReport "NWIND.MDB","@Report","@RCtrls",InName,False
Case 5
DumpMacroInfo "NWIND.MDB","@Macro",InName
Case 6
DumpModuleInfo "NWIND.MDB","@Procs","@Vars",InName
End Select
DoCmd Hourglass False
End Function
- Save and close the module.
Combine Form and Module to Create Object Analyzer
- Open the Little Analyzer form.
- In the text box, type "Categories" (without the quotation marks).
- Choose the Tables button. You have created an Object Analyzer.
The Object Analyzer analyzes the Categories table and creates a table
called @Table, which contains information about the structure of the
Categories table.
If you have the Database Analyzer library loaded, you can use these
commands to build your own object-analysis tool, or you can incorporate
these commands into your application to make it self-documenting.
|