>

Table Property

Applies To

Relation Object.

Description

Sets or returns a value that specifies the name of a Relation object's primary table. This name is the Name property setting of a TableDef or QueryDef object. The Table 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 a 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 TableDefs collection. The data type is String.

Remarks

Use the Table property with the ForeignTable property to define a Relation object, which represents the relationship between fields in two tables or queries. Set the Table property to the Name property setting of the primary TableDef or QueryDef object, and set the ForeignTable property to the Name property setting of the foreign (referencing) TableDef or QueryDef object. The Attributes property determines the type of relationship between the two objects.

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 didn't exist in the ValidParts table and you had not indicated No Enforcement in the Attributes property, a trappable error would occur.

In this case, the ValidParts table is 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 the OrderItem table. The Name property and ForeignName property of the Field object would both be set to PartNo.

The following illustration shows how the ValidParts table is primary because it's referenced by the OrderItem table.

See Also

Attributes Property, Field Object, ForeignTable Property, Name Property, QueryDef Object.

Example

See the ForeignName property example.

Example (Microsoft Access)

See the ForeignName property example (Microsoft Access).