ACC1x: Practice Using Object Analyzer Commands

ID: Q88651


The information in this article applies to:


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


  1. Open the sample database NWIND.MDB and create a new form called Little Analyzer.


  2. Add a text box control to the form. Change the ControlName property to Name.


  3. Add an option group control called Options to the form.


  4. 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 


  5. For the AfterUpdate property of the Options option group, specify the following:

    =AnalyzeIt(Name, Options)


  6. Save and close the form.


Creating a Module


  1. Open the sample database NWIND.MDB.


  2. 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 


  3. Save and close the module.


Combine Form and Module to Create Object Analyzer


  1. Open the Little Analyzer form.


  2. In the text box, type Categories.


  3. 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.


Keywords          : kbprg 
Version           : 1.0 1.1
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: March 9, 1999