I'm creating table relationships with VBA, which works fine except for tables which have ForeignKeys with no corresponding PrimaryKey in the linked table.
My code is as follows:
More succinctly, Acc_tbFindings.FKImpact has Null valves, while Acc_tbImpact.PKImpact has no Null values. Referential integrity is not enforced.
Thank you in advance for your help.
My code is as follows:
PHP:
Dim db As DAO.Database
Dim Rel As DAO.Relation
Dim Fld As Field
Set db = CurrentDb()
Set Rel = db.CreateRelation( _
"Acc_tbFinding-Acc_tbImpact", _
"Acc_tbImpact2", _
"Acc_tbFindings2")
Rel.Attributes = dbRelationRight Or dbRelationDontEnforce
Set Fld = Rel.CreateField("PKImpact")
Fld.ForeignName = "FKImpact"
Rel.Fields.Append Fld
db.Relations.Append Rel
More succinctly, Acc_tbFindings.FKImpact has Null valves, while Acc_tbImpact.PKImpact has no Null values. Referential integrity is not enforced.
Thank you in advance for your help.