>

ForeignTable Property

Applies To

Relation Object.

Description

Sets or returns the name of the foreign table in a relationship. This property setting is read/write for a new Relation object not yet appended to a collection and read-only for an existing Relation object in the Relations collection.

Settings and Return Values

The setting or return value is a string expression that evaluates to the name of a table in the Database object's TableDefs collection. The data type is String.

Remarks

The ForeignTable property setting of a Relation object is the Name property setting of the TableDef or QueryDef object that represents the foreign table or query; the Table property setting is the Name property setting of the TableDef or QueryDef object that represents the primary table or query.

For example, if you had a list of valid part codes (in a field named PartNo) and stored in a ValidParts table, you could establish a relationship with an OrderItem table such that if a part code was entered into the OrderItem table, it must exist in the ValidParts table. If the part code did not exist in the ValidParts table and you had not indicated no enforcement of referential integrity in the Attributes property, a trappable error would occur.

In this case, the ValidParts table would be an example of a foreign table, so the ForeignTable property of the Relation object would be set to ValidParts and the Table property of the Relation object would be set to OrderItem. The Name property and ForeignName property of the Field object would both be set to PartNo.

See Also

ForeignName Property, Name Property, QueryDef Object, Table Property, TableDef Object.

Example

See the ForeignName property example.

Example (Microsoft Access)

See the ForeignName property example (Microsoft Access).