Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Printing list of table relationships

Status
Not open for further replies.

hambo12

Technical User
Dec 16, 2003
60
0
0
AU
I am trying to find the table relationships for a rather complex access database.

I open it up, and can view the table relationships in diagram form. It is a huge mess of tables and relationships. I dont want to go through and move each table to print it in diagram form.

So can I print a test list of table relationships for easy reference??
 
Have you tried Tools|Analyze|Documenter|Current Database|Relationships?

Cogito eggo sum – I think, therefore I am a waffle.
 
Code:
Public Function fncDocumentRelations() As String
  Dim strDocument As String
  Dim rel As DAO.Relation
  Dim fld As DAO.Field
  Dim idx As DAO.Index
  Dim prop As DAO.Property
  For Each rel In CurrentDb.Relations
      strDocument = strDocument & vbCrLf & "Name: " & rel.Name & vbCrLf
      strDocument = strDocument & "  " & "Table: " & rel.Table & vbCrLf
      strDocument = strDocument & "  " & "Foreign Table: " & rel.ForeignTable & vbCrLf
      For Each fld In rel.Fields
        strDocument = strDocument & "  PK: " & fld.Name & "   FK:" & fld.ForeignName
        strDocument = strDocument & vbCrLf
      Next fld
  Next rel
  fncDocumentRelations = strDocument
  
End Function

run this and it will return something like this for each relation:

Name: tblRequirementstblProposedRequirement
Table: tblRequirements
Foreign Table: tblProposedRequirement
PK: strNewSR_Number FK:strParentSRNumber
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top