K
Katrina
Jon, I used the code from your site,(if any one else is
reading this, the code is p[asted below) but when it runs
through the code to add a relation I get the error
"You cannot add or change a record because a related
record is required in table "TABLENAME""
Where TABLENAME is the valid name of one of my tables.
I checked and all of the tables are in the BE...
any suggestions?
This is the code that it's having a problem with
Dim astr(1 To 100, 1 To 4) As String
For Each rel In dbFE.Relations
For Each fld In rel.Fields
astr(intLoop, 1) = rel.Table
astr(intLoop, 2) = rel.ForeignTable
astr(intLoop, 3) = fld.NAME
astr(intLoop, 4) = fld.ForeignName
intLoop = intLoop + 1
Next fld
Next rel
For intLoop = 1 To intRelCount + 1
Set rel = dbBE.CreateRelation(astr(intLoop, 1) &_
astr intLoop, 2), astr(intLoop, 1), astr(intLoop, 2))
rel.Fields.Append rel.CreateField(astr(intLoop, 3))
rel.Fields(astr(intLoop, 3)).ForeignName = astr_
(intLoop, 4)
dbBE.Relations.Append rel
Next intLoop
reading this, the code is p[asted below) but when it runs
through the code to add a relation I get the error
"You cannot add or change a record because a related
record is required in table "TABLENAME""
Where TABLENAME is the valid name of one of my tables.
I checked and all of the tables are in the BE...
any suggestions?
This is the code that it's having a problem with
Dim astr(1 To 100, 1 To 4) As String
For Each rel In dbFE.Relations
For Each fld In rel.Fields
astr(intLoop, 1) = rel.Table
astr(intLoop, 2) = rel.ForeignTable
astr(intLoop, 3) = fld.NAME
astr(intLoop, 4) = fld.ForeignName
intLoop = intLoop + 1
Next fld
Next rel
For intLoop = 1 To intRelCount + 1
Set rel = dbBE.CreateRelation(astr(intLoop, 1) &_
astr intLoop, 2), astr(intLoop, 1), astr(intLoop, 2))
rel.Fields.Append rel.CreateField(astr(intLoop, 3))
rel.Fields(astr(intLoop, 3)).ForeignName = astr_
(intLoop, 4)
dbBE.Relations.Append rel
Next intLoop