Save table to a collection : DBEngine « Access « VBA / Excel / Access / Word






Save table to a collection

 

Sub exaCollections()
    Dim colParent As New Collection
    Dim colChild As New Collection
     
    Dim tdfBooks As TableDef
    Dim objVar As Object
     
    Set tdfBooks = DBEngine(0)(0).TableDefs!Employees
     
    colParent.Add colChild
    colParent.Add tdfBooks
     
    Debug.Print colParent.Count
    For Each objVar In colParent
       If TypeOf objVar Is Collection Then
          Debug.Print "Collection"
       ElseIf TypeOf objVar Is TableDef Then
          Debug.Print objVar.Name
       End If
    Next
 
End Sub

 








Related examples in the same category

1.Reference TableDefs from DBEngine
2.Enumerate groups and users