Relationship Print Wizard

A

Allen Browne

Access 2000 and later have "print relationships" built in.

In relationships view, choose Print from the File menu.
 
B

bw

Thanks, Allen!

I was disappointed that the "Print from the File menu" didn't provide more
information. In addition to printing the relationships, I was also looking
for a complete summary of each relationship (like those seen in the "Edit
Relations" ship dialog box).

Am I looking for too much?
Bernie
 
A

Allen Browne

You could loop through the Relations collection, and print out lots of
details about the relationships (including the hidden relationships), such
as the names of the tables and fields involved in the relationships.

The Attributes of the relation should give you the details you see in the
Create Relations dialog.

Here's the basic idea to get you started:

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
For Each fld In rel.Fields
Debug.Print , fld.Name, fld.ForeignName
Next
Next

Set fld = Nothing
Set rel = Nothing
Set db = Nothing
End Function


BTW, if you are really interested in the attributes, there's one that does
not show up under DAO at all. JET 4 includes for Cascade-to-Null relations,
e.g. if you delete a Category from the lookup table, the Products in the
category are not deleted but Product.CategoryID cascades to Null. This
particular gem is available only through ADOX, i.e. not even through the
interface (which uses DAO).
 
B

bw

Thanks again,
I'll muse over this for awhile. Looks like this will provide what I want...
Bernie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top