我试图在表中添加2列" schede"但我总是返回错误3219.有人可以帮忙吗?这是代码:
Dim db As Database
Set db = CurrentDb()
'add columns
Dim campo1 As Field
Set campo1 = db.TableDefs("SCHEDE").CreateField("cliente", dbText, 6)
CurrentDb.TableDefs("SCHEDE").Fields.Append (campo1)
Set campo1 = CurrentDb.TableDefs("SCHEDE").CreateField("da_canc", dbText, 3)
CurrentDb.TableDefs("SCHEDE").Fields.Append (campo1)
答案 0 :(得分:0)
由于Fields.Append是一个子(不是函数),你必须在没有括号的情况下传递它的参数(或者在开头添加Call
)。还要重用您的数据库引用(db
)。
Dim db As DAO.Database 'Library name to clearfy reference (e.g ADODB has a database object too)
Set db = CurrentDb()
'add columns
With db.TableDefs("SCHEDE") 'for DRY
.Fields.Append .CreateField("cliente", dbText, 6)
.Fields.Append .CreateField("da_canc", dbText, 3)
End With