# Relating Data to a Marked Text Field

> Relate strings or numbers such as database field names to marked text fields with FieldData, read them in FieldClicked and keep them when copying or saving.

- **Product:** TX Text Control ActiveX
- **Section:** Documentation
- **Kind:** Topic
- **Path:** TX Text Control ActiveX > Document Editor > Marked Text Fields > Relating Data to a Marked Text Field
- **420 words**
- **Web URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/data/
- **LLMs URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/data/llms.txt
- **LLMs-Full URL:** https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/data/llms-full.txt

---

A marked text field can carry data of its own that users never see: a database field name or any other string or number your application needs. `TXTextControl` stores it for each field through the [FieldData](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fielddata-property/llms-full.txt) property, which takes the field's identifier.

### Link Fields to Database Fields

A typical use is a `TXTextControl` that shows the contents of a database. You create one marked text field for each database field and store the name of the database field in the marked text field with [FieldData](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fielddata-property/llms-full.txt).

Other parts of the program then read [FieldData](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fielddata-property/llms-full.txt) to find out which database field a marked text field is linked to. When the user clicks a marked text field, for example, the [FieldClicked](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fieldclicked-event/llms-full.txt) event passes the field's identifier. Read [FieldData](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fielddata-property/llms-full.txt) with this identifier, and it returns the name of the database field the user clicked.

### What the Data Can Be

- **Strings and numbers.** [FieldData](https://docs.textcontrol.com/tx-text-control-activex/reference/txtextcontrol/fielddata-property/llms-full.txt) accepts both.
- **One value per field.** Setting new data overwrites all data set before, whatever its kind.
- **Separate from the text.** Setting or reading the data does not change the text the field shows.
- **Kept with the field.** When a field is copied through the clipboard or saved to a file, its data is copied or saved with it.

### Related Pages

- [Marked Text Fields](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/llms-full.txt): field identifiers, the current field and the field events.
- [Special Types of Marked Text Fields](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/special-types/llms-full.txt): type-related data of links, page numbers and Word fields.
- [Using Marked Text Fields in Visual Basic](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/tutorial/llms-full.txt): marked text fields in a Visual Basic application.

---

## Nearby

- **Previous:** [Editing Marked Text Fields](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/editing/llms-full.txt)
- **Next:** [Special Types of Marked Text Fields](https://docs.textcontrol.com/tx-text-control-activex/document-editor/fields/special-types/llms-full.txt)
