Module: MSysObjectsInfo in Category Microsoft Access : Objects from Total Visual SourceBook

Retrieve Access object information from the MSysObjects table using VBA and VB6.

Procedure Name Type Description
(Declarations) Declarations Declarations and private variables for the modMSysObjectsInfo module.
AccessObjectsToArray Procedure Builds a zero based array containing a dictionary (list) of all Access objects using the MSysObjects table. The array includes the object type and the object name.
AccessObjectsToTable Procedure Builds a dictionary of Access objects to a table. If the table exists, it is emptied. If the table does not already exist, it is created. The created table has the following structure: FIELD NAME FIELD TYPE ObjectType Text(10) ObjectName Text(64).
GetAccessID Procedure Get the internal Access ID number for an object. Access maintains a unique long integer id number for every object in the database. This function returns that value.
GetAccessIDInfo Procedure Get the name of the object associated by the internal Access ID number. Access maintains a unique long integer id number for every object in the database. This function returns the object with the specified value.
' Example of modObjectInfo
' To try this example, do the following:
' 1. Create a new form in your copy of Sample.mdb (in the Total Visual SourceBook sample directory).
' 2. Create a command button 'cmdTest'
' 3. Paste this code into the form's module

Private Const cstrTable As String = "Categories"

Private Sub Form_Open(Cancel As Integer)
  cmdTest.Caption = "Test Access object information functions"
End Sub

Private Sub cmdTest_Click()
  Dim astrNames() As String
  Dim intCounter As Integer
  Dim lngAccessID As Long
  Dim strName As String

  ' Example of AccessObjectsToArray
  AccessObjectsToArray CurrentDb, astrNames
  For intCounter = LBound(astrNames) To UBound(astrNames)
    Debug.Print "Object: " & astrNames(intCounter)
  Next intCounter

  ' Example of AccessObjectsToTable
  AccessObjectsToTable CurrentDb, "FMS Object Dictionary"

  ' Example of GetAccessID
  lngAccessID = GetAccessID(CurrentDb, cstrTable, acTable)
  Debug.Print "Object ID: " & lngAccessID

  strName = GetAccessIDInfo(CurrentDb, lngAccessID)
  Debug.Print "Name for Object ID " & lngAccessID & " is " & strName

End Sub

Total Visual SourceBook The source code in Total Visual Sourcebook includes modules and classes for Microsoft Access, Visual Basic 6 (VB6), and Visual Basic for Applications (VBA) developers. Easily add this professionally written, tested, and documented royalty-free code into your applications to simplify your application development efforts.

Total Visual SourceBook is written for the needs of a developer using a source code library covering the many challenges you face. Countless developers over the years have told us they learned some or much of their development skills and tricks from our code. You can too!

Additional Resources

Total Visual SourceBook CD and Printed Manual

Microsoft Access/ Office 2016, 2013, 2010, and 2007 Version
is Shipping!

New features in Total Visual SourceBook for Access, Office and VB6

Supports Access/Office 2016, 2013, 2010 and 2007, and Visual Basic 6.0!

View all FMS products for Microsoft Access All Our Microsoft Access Products


Reader Choice Award for MS Access Source Code Library
Reader Choice

"The code is exactly how I would like to write code and the algorithms used are very efficient and well-documented."

Van T. Dinh, Microsoft MVP

SourceBook Info

Additional Info




Free Product Catalog from FMS