This function lists the indexes of a table, and the fields involed in the
index.
If it is a Foreign index, you can use the properties to determine the
foreign table and field.
Function ShowIndexes(strTable As String)
Dim db As DAO.Database
Dim tdf As DAO.TableDef
Dim ind As DAO.Index
Dim fld As DAO.Field
Set db = DBEngine(0)(0)
Set tdf = db.TableDefs(strTable)
For Each ind In tdf.Indexes
Debug.Print ind.Name, IIf(ind.Primary, "Primary", ""), _
IIf(ind.Foreign, "Foreign", ""), ind.Fields.Count
Debug.Print " Field(s): ";
For Each fld In ind.Fields
Debug.Print fld.Name;
Next
Debug.Print
Next
Set ind = Nothing
Set tdf = Nothing
Set db = Nothing
End Function
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"Filips Benoit" <benoit.filips@pandora.be> wrote in message
news:VeBvd.35$Dh4.139336@phobos.telenet-ops.be...[color=blue]
> Dear All,
>
> Is ( how) it possible to find the tablename of the table that is related
> to
> a field.
>
> Field CLIENT_TITLE_ID is related to table TITLE
>
> Thanks,
>
> Filip
>
>[/color]