you can't use sql to access tabledefs.
to access the tabledefs collection you use
currentdb.tabledefs
for a particular table it would be
currentdb.tabledefs("myTable")
and to loop through all the tables it would be for example
Code:
dim tdef as tabledef
for each tdef in currentdb.tabledefs
debug.print tdef.name
next tdef
and to access the individual fields, you reference the tabledef fields collection
Code:
dim fld as dao.field
for each fld in tdef.fields
debug.print fld.name; fld.type
next fld
put it all together and you have
Code:
dim tdef as tabledef
dim fld as dao.field
for each tdef in currentdb.tabledefs
debug.print tdef.name
for each fld in tdef.fields
debug.print fld.name; fld.type
next fld
next tdef
or if you just want a specific table
Code:
for each fld in currentdb.tabledefs("myTable")
debug.print fld.name; fld.type
next fld