Create Relation
Sub exaRelations()
Dim db As Database
Dim rel As Relation
Dim fld As Field
Set db = CurrentDb
Set rel = db.CreateRelation("PublisherRegions", "PUBLISHERS", "SALESREGIONS")
rel.Attributes = dbRelationUpdateCascade
Set fld = rel.CreateField("PubID")
fld.ForeignName = "PubID"
rel.Fields.Append fld
db.Relations.Append rel
End Sub
Related examples in the same category