Results 1 to 2 of 2

Thread: MSysRelationships - Access 97 *RESOLVED*

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424

    MSysRelationships - Access 97 *RESOLVED*

    How do I change/delete this object through code. I need to change the permissions in order to access this object first of all. Ok so I've manually done that but this database still considers itself read-only. I need to copy the relationships from one database to another but this object is really frustrating me.

    Thanks
    Last edited by Ephesians; Jun 2nd, 2003 at 01:45 PM.

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2002
    Posts
    424

    Nevermind

    Don't worry about it. I took care of it myself.
    VB Code:
    1. Public Sub CopyRelations()
    2. Dim dBase As Database, dBase2 As Database
    3. Dim tmpRelation As Relation, newrel As Relation
    4. Dim fld As Field, newfld As Field
    5.  
    6. Set dBase = CurrentDb
    7. Set dBase2 = OpenDatabase(strFileLocation)
    8.  
    9.  
    10. For Each tmpRelation In dBase.Relations
    11.      Set newrel = dBase2.CreateRelation(tmpRelation.Name, tmpRelation.Table, tmpRelation.ForeignTable, tmpRelation.Attributes)
    12.      
    13.      For Each fld In tmpRelation.Fields
    14.           Set newfld = newrel.CreateField(fld.Name)
    15.           newfld.ForeignName = fld.ForeignName
    16.           newrel.Fields.Append newfld
    17.      Next
    18.      dBase2.Relations.Append newrel
    19. Next
    20.  
    21. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width