我发现下面的代码可以创建旧版本的access数据库,上面的代码出现所提到的红色显示,及无效字符提示,能不能创建新版本的数据库.
Private Sub Command1_Click()
Dim DefDatabase As Database
Dim DefTable As TableDef, DefField As Field
Dim TdbName As String
TdbName = "c:\dd.mdb"
CreateDatabase TdbName, dbLangGeneral
Set DefDatabase = Workspaces(0).OpenDatabase(TdbName, 0, False)
Set DefTable = DefDatabase.CreateTableDef("table1")
Set DefField = DefTable.CreateField("Fiele1", dbInteger, 1)
DefTable.Fields.Append DefField
Set DefField = DefTable.CreateField("Fiele2", dbText, 8)
DefTable.Fields.Append DefField
DefField.AllowZeroLength = True
DefDatabase.TableDefs.Append DefTable
End Sub