Anybody know how to do a lookup of the datatype for a field in an access database? I want to bring the table name and field name in as variables and then lookup the datatype for that field.
Use DAO. Start by assigning CurrentDb() to a Database object variable. Then access the table definition from the TableDefs collection, and from that get the field definition from the Fields collection. The resulting Field object has a Type property that gives the field data type. Some of the possible values are dbText, dbMemo, dbLong, etc.
Note: An "autonumber" field will be of type dbLong. If you need to know whether a dbLong field is actually an autonumber, you'll also have to test the Field object's Attributes property, using the dbAutoIncrField bit mask. Rick Sprague
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.