iterates the AllTables collection, opens each nonsystem table, prints its structure, and then closes the open table. : AllTables « Access « VBA / Excel / Access / Word






iterates the AllTables collection, opens each nonsystem table, prints its structure, and then closes the open table.

 
Public Sub PrintTableStructures()
    
    Dim tbl As Variant
    
    For Each tbl In CurrentData.AllTables
          
       If InStr(1, tbl.Name, "MSys", vbBinaryCompare) = 0 Then
          DoCmd.OpenTable tbl.Name, acViewDesign
          If MsgBox("Print table structure?", _
                    vbQuestion Or vbYesNoCancel, _
                    "Print Table Structure") = vbYes Then
             DoCmd.PrintOut acPrintAll
          End If
          DoCmd.Close acTable, tbl.Name, acSaveNo
       End If
    Next
   
End Sub

 








Related examples in the same category

1.Delete backup tables
2.iterates the AllTables collection looking for a table whose name includes the substring "Backup".
3.iterates the AllTables collection to determine if a table is open. If it is, it prompts the user to close it.