debug.print application.currentDb.tableDefs("sales").fields.count
fields property can be used to iterate over a table's columns. option explicit
sub main() ' {
dim db as database
set db = currentDb()
dim t as tableDef
set t = db.tableDefs("MSysObjects")
dim col as field
for each col in t.fields
debug.print(col.name)
next col
end sub ' }
fields property is field2 attributes is a long that is interpreted as a bit field. tableDefAttributeEnum lists some of these flags: dbAttachedODBC | 536870912 | Linked ODBC database table. |
dbAttachedTable | 1073741824 | Linked non-ODBC database table. |
dbAttachExclusive | 65536 | Opens a linked Microsoft Access database engine table for exclusive use. |
dbAttachSavePWD | 131072 | Saves user ID and password for linked remote table. |
dbHiddenObject | 1 | Hidden table (for temporary use). |
dbSystemObject | -2147483646 | System table. table } |