【发布时间】:2018-11-21 10:11:47
【问题描述】:
我想用来自同一个表中的其他列的连接来完成该列,但我得到了错误。我的代码如下:
Dim tbl2 As DAO.TableDef
Dim db2 As DAO.Database
Dim fld2 As DAO.Field
Set db2 = CurrentDb
Set tbl2 = db2.TableDefs("Table")
With tbl2
Set fld2 = tbl2.CreateField("Concatenate", dbText)
.Fields.Append fld2
'*and below is the part when I get errors on both options:*
fld2.Expression = "Account" & "-" & "Name" '<-- I get an error "Method or data member not found
fld2.Attributes = "Account" & "-" & "Name" '<-- when I change to this I get an error "Type mismatch"
End With
Set fld2 = Nothing
Set tbl2 = Nothing
Set db2 = Nothing
实际上代码有效,字段被正确创建为文本,但它不想用值完成。
你能帮忙吗?如何更改代码?两个选项都错了!
【问题讨论】:
标签: ms-access dao create-table