Option Explicit

Private db As Database

Private td As TableDef

Private f As Field

 

Private Sub Command1_Click()

Set db = DBEngine.CreateDatabase("d:\01.mdb", dbLangGeneral)

Set td = New TableDef

 

Set f = td.CreateField("NAME", dbText, 20)

td.Fields.Append f

 

Set f = td.CreateField("ID", dbText, 5)

td.Fields.Append f

 

Set f = td.CreateField("DEPARTMENTP", dbText, 60)

td.Fields.Append f

 

 

td.Name = "class"

db.TableDefs.Append td

 

Set db = Nothing

 

End Sub

 

在列表框中显示该字段名

你可以设一个变量,取得"该字段名",再添加到列表框中(加上循环),列表框的操作你可以看VB的帮助