>
Foreign Property
Applies To
Index Object.
Description
Returns a value that indicates whether an Index object represents a foreign key in a table. This property setting is read-only and returns True (-1) if the Index object represents a foreign key.
Remarks
A foreign key consists of one or more fields in a foreign table that uniquely identify all rows in a primary table.
The Microsoft Jet database engine creates an Index object for the foreign table and sets the Foreign property when you create a relationship that enforces referential integrity.
See Also
Primary Property, TableDef Object.
Example (Microsoft Access)
The following example prints the value of the Foreign property for each index in an Orders table.
Sub CheckForeign()
Dim dbs As Database, tdf As TableDef, idx As Index
' Return Database variable that points to current database.
Set dbs = CurrentDb
Set tdf = dbs.TableDefs!Orders
' Enumerate through Indexes collection of Orders table.
For Each idx In tdf.Indexes
' Print value of Foreign property.
Debug.Print idx.Name; " "; idx.Foreign
Next idx
End Sub