Enumerate Relations Fields

K

Kahuna

Hi folks

I use code similar to the following to iterate through the relations
collection to get a listing of all relationships in a particular Db.

Sub EnumRelation()
'*********************************Test Code
Dim dbs As Database
Dim fld As Field
Dim rel As Relation

Set dbs = CurrentDb
For Each rel In dbs.Relations
MsgBox ("Name: " & rel.Name & ", Table: " & rel.Table & ", Forieng
Table: " & rel.ForeignTable)
Next rel
Set dbs = Nothing
End Sub

I need to include both field names included in the relationship however and
I am struggling with the syntax.

Tried a combination including:

rel.Fields.(0)
rel.Fields.Field(0)

etc What's the correct syntax for this reference?

TIA
 

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