WklTokenBox
WklTokenBox shows the short list of values that belong to a record, such as a user's roles or a
document's tags, as tokens with a remove button. Users type new values with the help of
suggestions. It binds like a subform: each token is a row in a child table and is inserted or
deleted immediately.
Get started
Common tasks
Visual aid
+- frmUser: Form View -------------------------------------------------+ | Name [ Miller ] | | Roles [ (Reader x) (Author x) adm| ] 1 2 3 | | +---------------------+ | | | Admin | 4 | | +---------------------+ | +----------------------------------------------------------------------+
| Region | Meaning |
|---|---|
| 1 | A token: one child row in tblUserRole, with its remove button |
| 2 | Another token; Left and Right move between tokens, and Delete removes the selected one |
| 3 | The input area: typing shows suggestions, and Enter or a separator adds the value |
| 4 | The suggestions from SuggestionSource (or SuggestionList); Down opens the list |
Key features
- Binds like a subform (
RecordSource,ValueField,LinkChildFields,LinkMasterFields), including multiple link fields and ODBC sources; it follows the form's record through its Control Source. - Suggestions as you type from a value list or from a table, query, or SQL statement; you can restrict input to suggested values (
AllowFreeText). - Rules per value: a regular expression with its message (
Pattern,ValidationText) and no duplicates; when a value is rejected, the reason appears below the box and inErrorText. - Events before and after each change (
TokenAdding…Change), withCancel, plusDataErrorfor rows the table rejects. - The same chips in lists: a read-only
wedTokenscolumn inWklGridandWklTreeList. - Screen readers announce a list with a remove button for each token.
- Designer (the Custom
[...]row): data, suggestions and rules, and appearance.
Core concepts
Rows, not a field. The values live in a child table, one row per token. Just as a subform saves its rows, there's no pending state and no Undo. Access multivalued fields are avoided on purpose: they exist only in Access tables.
The record is in charge. On a new record that doesn't have a key yet, the box rejects input, just as a subform rejects rows until its parent record exists. A locked box, or a form that doesn't allow edits, shows the tokens without remove buttons.
Unbound use. Without a RecordSource, the box keeps its values in Text, joined by
Separator, and your code saves them.
Administration
Troubleshooting
For developers
Related topics
None