Sub CreateRelationX()
Dim relNew As Relation
With CurrentDb
Set relNew = .CreateRelation("表2表1ID编号", "表2", "表1", dbRelationDontEnforce + dbRelationUnique) 'dbRelationUnique)表示一对一
relNew.Fields.Append relNew.CreateField("ID")
relNew.Fields!ID.ForeignName = "编号"
.Relations.Append relNew
.Close
End With
End Sub
用VBA代码建立表间字段的关系
最新推荐文章于 2021-05-03 16:12:47 发布