在Access中用代码建立表和字段,通常用DAO的方式。
如:
Dim dbs As DAO.Database
Dim tdf As DAO.TableDef
Dim fld As DAO.Field
Set dbs = CurrentDb
Set tdf = dbs.CreateTableDef("表1")
Set fld = tdf.CreateField("字段1", dbText)
tdf.Fields.Append fld
dbs.TableDefs.Append tdf
或:
CurrentDb.Execute "CREATE TABLE 表1(字段1 TEXT);"