Importing/Exporting Relationships

前端 未结 4 1987
渐次进展
渐次进展 2021-01-13 14:16

I have a couple of mdb files with the exact table structure. I have to change the primary key of the main table from autonumber to number in all of them, which means I have

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-13 15:20

    Thanks for code snippet. to get rid of your 3284 error I have changed a few things. If you copy all indexes from sample mdb and then try to put relationships it throws an exception as it expects no idexes for relationshisps when you put relationships it puts its own indexes. Steps I followed are (assume target.mdb and source.mdb):

    1. Run this code in target.mdb remove all indexes and relationsships frmo target.mdb by calling ChangeTables
    2. Call AddIndexesFromBU source.mdb and use condition
      If ndxBU.Unique Then tdf.Indexes.Append ndx End If this willput just Unique index
    3. call AddRelationsFromBU source.mdb and put all relationsships
    4. Call again AddIndexesFromBU source.mdb and change condition to If not ndxBU.Unique Then

    I have also added error trap same as AddRelationsFromBU in AddIndexesFromBU and resume next for if ans else

    This worked for me.

提交回复
热议问题