Refresh Method Example (MDB)

The following example refreshes the Indexes collection of a TableDef object. In a database in a multiuser environment, you can use the Refresh method to show changes made by other users to the Index objects in a TableDef object's Indexes collection.

Sub RefreshIndex()
    Dim dbs As Database, tdf As TableDef
    Dim idx As Index, fld As Field
    
    ' Return reference to current database.
    Set dbs = CurrentDb
    Set tdf = dbs.TableDefs!Employees
    tdf.Indexes.Refresh
    For Each idx In tdf.Indexes
        Debug.Print idx.Name; ":"
        For Each fld In idx.Fields
            Debug.Print "   "; fld.Name
        Next fld
    Next idx
    Set dbs = Nothing
End Sub