Exporting Relationships

  • Thread starter Thread starter Katrina
  • Start date Start date
K

Katrina

I have a database set up with a master copy, a front end
and a back end.
The master copy contains all of the info, and is then
exported to the front and back ends periodically.

I have a module set up to export all of the objects
automatically... however, it doesn't export the
relationships. I cannot automatically export the tables
without first using the code to delete them, so I have it
set up to delete them and then replace them.

How can I get this to recognise the relationships also?

Katrina
 
"Katrina" said:
I have a database set up with a master copy, a front end
and a back end.
The master copy contains all of the info, and is then
exported to the front and back ends periodically.

I have a module set up to export all of the objects
automatically... however, it doesn't export the
relationships. I cannot automatically export the tables
without first using the code to delete them, so I have it
set up to delete them and then replace them.

How can I get this to recognise the relationships also?

Katrina

Katrina

There is some code on my web site, at
http://www.applecore99.com/tbl/tbl021.asp, that shows how you can split a
database using code. The second function on there should give you a few
pointers in the right direction.
 
I used the code from your site, 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

-----Original Message-----
 
Back
Top