dataLink
Topic group Related topics Example
The Field object that is linked to the component.
Property of
Many form components
Description
You link a form component to a table’s field by assigning a reference to the dataLink property of the component. The reference you assign is to the Field object that represents the field in an open query. This assignment is called dataLinking. When a form component and Field object are linked in this way, they are said to be dataLinked.
Exception: a Grid object is dataLinked to a rowset, not a field.
For compatibility with earlier versions of dBASE, you may also assign the field name in a string. This technique is used for form-based data handling with tables open in work areas only.
Both field and component objects have a value property. (Fields in a table open in a work area do not have any properties, but they have a value; the concept is the same.) When they are dataLinked, changes in one object’s value property are echoed in the other. The form component’s value property reflects the value displayed in the component at any given moment. If the component’s value is changed, it is copied into the field after the component loses focus.
The value property for all fields in a rowset are set when you first open a query and updated as you navigate from row to row. The value properties for components dataLinked to those fields are also updated at the same time, unless the rowset’s notifyControls property is set to false. You can also force the components to be updated by calling the rowset’s refreshControls( ) method, which is useful if you have set a field’s value property through code.
Form-based data events such as onNavigate will not work unless the form has controls dataLinked to fields. For example, if you USE a table, create and open an empty Form, assign an onNavigate event handler, and SKIP in the table, the onNavigate will not fire simply because the form is open.
The dataLink property is similar to the dataSource property used for Image objects, except that data displayed through the dataLink property can be changed, while data displayed through the dataSource property is always read-only.
A component’s dataLink is automatically set when you use the Form wizard or use a field in the Field palette.