I have code that creates a Relationship from VBA ; however, what I want is to Include ALL records from 'A' and only those records from 'B' where the joined fields are equal. Currently code creates an join where both tables are equal.
Can anyone help me???
Dim db As Database, rel As Relation, fld As FIELD
Set db = CurrentDb()
Set rel = db.CreateRelation("AtoB", "A", "B")
rel.Attributes = dbRelationDeleteCascade + dbRelationUpdateCascade
Set fld = rel.CreateField("WELLNAME")
fld.ForeignName = "WELLNAME"
rel.Fields.Append fld
db.Relations.Append rel
db.Relations.Refresh
Set db = Nothing
Thanks!
Can anyone help me???
Dim db As Database, rel As Relation, fld As FIELD
Set db = CurrentDb()
Set rel = db.CreateRelation("AtoB", "A", "B")
rel.Attributes = dbRelationDeleteCascade + dbRelationUpdateCascade
Set fld = rel.CreateField("WELLNAME")
fld.ForeignName = "WELLNAME"
rel.Fields.Append fld
db.Relations.Append rel
db.Relations.Refresh
Set db = Nothing
Thanks!