Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBA Relationship Join type Question for Access

Status
Not open for further replies.

keusch

Technical User
Jun 17, 2001
41
US
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!
 
You may try this:
rel.Attributes = dbRelationDeleteCascade + dbRelationUpdateCascade + dbRelationLeft

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top