[Overview][Constants][Types][Classes][Procedures and functions][Index] | Reference for unit 'DBCtrls' (#lcl)

# TDBLookup.KeyFieldValue

Gets the value(s) for one or more key fields defined for the Field in the linked dataset.

## Declaration

Source position: dbctrls.pp line 156

`public function TDBLookup.KeyFieldValue: Variant;`

## Function result

Variant value for the key fields in the field definition for the control.

## Description

KeyFieldValue is a Variant function used to get one or more values for fields which make up the index key for the linked dataset in the control. KeyFieldValue uses the internal TFieldDataLink instance in the class to get the return value for the method. The return value contains the content from the FieldValues property for the linked DataSet.

The return value is Null under the following conditions:

- The internal data link has not been assigned
- The Dataset in the data link is not Active
- The Field in the data link does not have defined key field names

KeyFieldValue is useful for getting the index value for the current record in the linked dataset. It is not, however, used in the implementation of the class or descendants.

## See also

TDBLookup.KeyField |  | The name of the KeyField used in the lookup search.
TFieldDataLink.Field |  | The Field to which the datalink is attached.
TDataLink.DataSet
TDataSet.FieldValues