List Database Objects

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Connell
    New Member
    • Jun 2007
    • 5

    #1

    List Database Objects

    I am using Access 2002.

    Is there a technique to produce a report listing all the tables, forms, queries, reports, etc.?
  • Scott Price
    Recognized Expert Top Contributor
    • Jul 2007
    • 1384

    #2
    Here's a link to Stephen Leban's website that contains an example of how to do this for the tables in a database: http://www.lebans.com/listtablesinmdb.htm

    This should point you in the right direction for the other items as well.

    Regards,
    Scott

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      Originally posted by Connell
      I am using Access 2002.

      Is there a technique to produce a report listing all the tables, forms, queries, reports, etc.?
      Here is basic code which will accomplish what you are requesting. Simply call the Function with the appropriate Parameter:
      [CODE=vb]Public Function GetObjectList(B yVal lngType As AcObjectType) As Variant
      ' Returns an array of object names.

      ' Parameters:
      ' intType -- one of acTable, acQuery, acForm,
      ' acReport, acDataAccessPag e, acMacro or acModule

      Dim intI As Integer
      Dim strName As String
      Dim astrOutput() As String
      Dim objCollection As Object
      Dim aob As AccessObject

      Select Case lngType
      Case acTable
      Set objCollection = CurrentData.All Tables
      Case acQuery
      Set objCollection = CurrentData.All Queries
      Case acForm
      Set objCollection = CurrentProject. AllForms
      Case acReport
      Set objCollection = CurrentProject. AllReports
      Case acDataAccessPag e
      Set objCollection = CurrentProject. AllDataAccessPa ges
      Case acMacro
      Set objCollection = CurrentProject. AllMacros
      Case acModule
      Set objCollection = CurrentProject. AllModules
      End Select

      intI = 0

      For Each aob In objCollection
      strName = aob.Name
      intI = intI + 1
      ReDim Preserve astrOutput(1 To intI)
      astrOutput(intI ) = strName
      Next aob

      GetObjectList = astrOutput
      End Function[/CODE]
      [CODE=vb]Private Sub Command6_Click( )
      'Given the Object type to enumerate, this Function creates a
      'list of Object names and returns that string. To return just specific Objects:
      Dim varList, T As Integer

      'one of acTable, acQuery, acForm,
      'acReport, acDataAccessPag e, acMacro or acModule

      varList = GetObjectList(a cForm) 'Returns all Forms

      For T = 1 To UBound(varList)
      Debug.Print varList(T)
      Next T
      End Sub[/CODE]
      OUTPUT:
      [CODE=text]subfChild
      Switchboard
      frmEmployees
      frmContinuous
      Main Form[/CODE]

      Comment

      • JConsulting
        Recognized Expert Contributor
        • Apr 2007
        • 603

        #4
        Originally posted by Connell
        I am using Access 2002.

        Is there a technique to produce a report listing all the tables, forms, queries, reports, etc.?

        You can also go to Tools/Analyze/Documenter from within access.
        J

        Comment

        Working...