Table relationship 
Author Message
 Table relationship


I would like to use VBA to delete all the table
relationships in one of my database.  Can anyone help?


Tue, 20 Jan 2004 10:04:58 GMT  
 Table relationship



>I would like to use VBA to delete all the table
>relationships in one of my database.  Can anyone help?


Sub KillAllRelations()
Dim db As DAO.Database
Dim rel As Relation
Dim inti As Integer
Set db = DBEngine(0)(0)
For inti = db.Relations.Count - 1 To 0 Step -1
    Set rel = db.Relations(inti)
    Debug.Print "Deleting relation "; rel.Name, rel.Table, _
    db.Relations.Delete rel.Name
    Next inti
End Sub

Make a backup first, of course. This is a small tactical nuke.

                  John W. Vinson[MVP]    
    Come for live chats every Tuesday and Thursday

Tue, 20 Jan 2004 12:59:13 GMT  
 [ 2 post ] 

 Relevant Pages 

1. How Can I Change Table Relationships Programmatically

2. Moving table relationships from database to database

3. Copying table relationships to another 2.0 mdb

4. DAO & table relationships

5. Chnage Access DB Table Relationships From VB6

6. Access Tables Relationship using Dynaset

7. Table Relationships Question - Access 97

8. About tables relationship!

9. Defining table relationships in VB

10. Table relationship

11. VisData-table relationships

12. About Tables Relationship


Powered by phpBB® Forum Software