Color scheme: Light
You are here: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library troubleshooting » The control shows error text instead of nodes

The control shows error text instead of nodes

In Form view, the control shows a message instead of nodes, for example, that a field is missing, that a key occurs twice, or that Access reported an error while reading the data.

Environment

All versions of WklTreeView and WklTreeList.

Cause

When the control loads on its own (because the form opens or a property changed), it shows a load error as text in the control instead of interrupting the user. When the load is triggered from VBA (Requery, SelectedKey = …, NodeCount), the same error raises a VBA error with a fixed number:

ConstantCause
wkeNotConfiguredRecordSource, KeyField, ParentField (or GroupFields) or TextField is empty
wkeSourceErrorAccess couldn't read the source: unknown table or field, SQL syntax error, missing parameter, or broken link; the Access message follows
wkeDuplicateKeyTwo records have the same value in KeyField
wkeCycleThe parent keys form a cycle (A is the parent of B, and B is the parent of A)

Resolution

  1. Read the message; for wkeSourceError, it contains the original Access message.
  2. Open the record source in Datasheet view: it must open without prompts and contain the fields named in KeyField, ParentField, and TextField.
  3. Make KeyField unique (a primary key), and check the parent keys for cycles.
  4. Queries with parameters: parameters are resolved like form references (Forms!frmMain!txtYear), so the referenced form must be open.
en/wiki/msaccess/comctl/troubleshooting/control-shows-error-text.txt · Last modified: by Wolfgang van der Stille