ACC1x: How to Make the Analyzer Include Field Descriptions

ID: Q109404


The information in this article applies to:


SUMMARY

The Object Analyzer utility that comes with Microsoft Access does not include field descriptions in its output. However, you can make the Analyzer include field descriptions by making some modifications to the utility.


MORE INFORMATION

To make the Analyzer include field descriptions in its output you need to modify the table RLTables and the function DumpTableInfo() in the ANALYZER.MDA library.

The following steps describe how to make the necessary modifications:

  1. Use Windows Notepad (or any other text editor) to open the MSACCESS.INI file that is in your Windows directory. If the line
    
          analyzer.mda= 
    exists in the [Libraries] section of the MSACCESS.INI file, put a semicolon at the beginning of the line. The modified line will be:


  2. 
          ;analyzer.mda= 
  3. Save and then close the MSACCESS.INI file. Start Microsoft Access and open the database ANALYZER.MDA.


  4. Open the RLTables table in Design view, and add a field called Description to the table. The field should have a data type of Text, with a length of 255 characters.


  5. Save and then close the table, and then open the module Object Analyzer.


  6. Find the function DumpTableInfo().


  7. Add the lines of code listed below to the function. Note that the lines to be added begin with the characters $$.

    NOTE: In the following sample code, an underscore (_) is used as a line-continuation character. Remove the underscore from the end of the line when re-creating this code in Access Basic.


  8. 
         Sub DumpTableInfo (TargetDB As String, SQLTarget1 As String, _
           ObjOption As String, IsAttached As Integer)
           CurrentProc = "DumpTableInfo"
    
           '$$ New code begins - declare new variables
           Dim F As Form, C As Control
           '$$ New code ends
    
           If Not TableExists(TargetDB, SQLTarget1) Then
    
              '$$ New code begins - change the SQL to include Description
              SQLSTRING$ = "Select TableName,Name,Type,Length,IndexName,_
                     Description Into [" & SQLTarget1 & "] in """ & TargetDB _
                     & """ From RLTables;"
              '$$ New code ends
    
              PerformSQLAction SQLSTRING$
           End If
    
           Set RT_Target = OpenDatabase(TargetDB)
           Set RT_Database = CurrentDB()
           Set RT_SysDB = CodeDB()
           Set RT_Table2 = RT_Target.OpenTable(SQLTarget1)
           Set RT_Dynaset1 = RT_Database.CreateDynaset(ObjOption)
           Set RT_Snapshot1 = RT_Dynaset1.ListFields()
           If Not IsAttached Then
              Set RT_Table1 = RT_Database.OpenTable(ObjOption)
              Set RT_Snapshot2 = RT_Table1.ListIndexes()
           End If
    
           '$$ New code begins - create a form in Design view
           Set F = CreateForm()
           'set the record source to the source table
           F.RecordSource = ObjOption
            '$$ New code ends
    
           Do Until RT_Snapshot1.EOF
              RT_Table2.AddNew
              RT_Table2!TableName = ObjOption
              RT_Table2!Name = RT_Snapshot1!Name
              RT_Table2!Type = LookUpFieldType(RT_Snapshot1!Type)
              RT_Table2!Length = RT_Snapshot1!Size
    
              '$$ New code begins - create a control for this field
              Set C = CreateControl(F.FormName, 109, 0, "", RT_Snapshot1!Name)
              'save the description from the field
              RT_Table2!Description = C.StatusBarText
              '$$ New code ends
    
              If Not IsAttached Then
                 ' Cannot use FindFirst method on List Snapshots
                 If RT_Snapshot2.RecordCount > 0 Then
                    RT_Snapshot2.MoveFirst
                    Do Until RT_Snapshot2.EOF
                       If RT_Snapshot2!FieldName = RT_Snapshot1!Name Then _
                           Exit Do
                       RT_Snapshot2.MoveNext
                    Loop
                    If Not RT_Snapshot2.EOF Then
                       RT_Table2!IndexName = RT_Snapshot2!IndexName
                    End If
                 End If
              End If
    
              RT_Table2.Update
              RT_Snapshot1.MoveNext
           Loop
    
           '$$ New code begins - close the form, say "No" to save changes
           DoCmd SetWarnings True
           SendKeys "n"
           DoCmd Close A_FORM, F.FormName
           '$$ New code ends
    
           RT_CloseAllObjects
         End Sub 
  9. Save and close the module, and then quit Microsoft Access.


  10. Use Windows Notepad (or any other text editor) to open the MSACCESS.INI file that is in your Windows directory. Remove the semicolon from the beginning of the
    
          ;analyzer.mda= 
    line in the [Libraries] section of the file. The modified line will be:


  11. 
          analyzer.mda= 
  12. Save and then close the file.



REFERENCES

For more information about the Object Analyzer, see the ANALYZER.TXT file that comes with Microsoft Access version 1.1 or the README.TXT file that comes with Microsoft Access version 1.0.

Additional query words:


Keywords          : kbusage 
Version           : WINDOWS:1.0,1.1
Platform          : WINDOWS 
Issue type        : kbhowto 

Last Reviewed: July 13, 1999