Question Extracting Relationships from access

donot

New member
Local time
Today, 08:20
Joined
Aug 18, 2016
Messages
3
Hello, I have inherited an access 2000 database that needs to be modified. When I go and look at the relationships I find that the relationship chart was not created. Is there a program that can find and extract all relationships between all the tables and queries?

Thanks
 
Code:
Function ShowRel()
Dim db As DAO.Database
Dim rel As DAO.Relation
Dim fld As DAO.Field

Set db = CurrentDb()
For Each rel In db.Relations
    Debug.Print rel.Name, rel.Table, rel.ForeignTable, rel.Attributes
    For Each fld In rel.Fields
        Debug.Print , fld.Name, fld.ForeignName
    Next
Next
End Function
 
arnelgp, thanks for the reply. Your code only works if there is stuff in the relationship diagram. The relationship diagram in the Access 2000 database that I have is blank. A relationship diagram was not created when the database was set up.
 
In that case, no global relationships were likely set up. You'll likely find the relationships within each query as you open them, and they may differ from query to query. It is not essential to access (but often helpful) to specify the relationships globally, so the developer may have chosen not to. Also, global relationships disappear if you move to SharePoint and some other database systems, so folks that program with that in mind often don't bother with specifying global relationships.

CB
 

Users who are viewing this thread

Back
Top Bottom