Barvna shema: Svetla
Trenutno dejavna stran: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library troubleshooting » The status label shows nothing or the wrong color

The status label shows nothing or the wrong color

A WklStatusLabel stays empty, shows the raw value instead of the text of an entry, keeps a gray (neutral) color, or shows the color of another record.

Environment

WklStatusLabel 1.23 or later, in Access forms and on Excel and Word UserForms.

Cause

  • Not bound, or bound to Null. Without a Control Source (ControlSource), the label shows its designed Text; with a field that's Null, it shows NullText (empty by default).
  • No entry for the value. An entry matches by value: numbers by value regardless of their type, and text regardless of case. A value without an entry is shown formatted with Format in the designed Kind, usually neutral gray.
  • The kind field doesn't hold a kind. KindField expects a number 0-5 or a name (neutral, ok, warn or warning, bad or error, info, muted); any other value, Null included, counts as neutral. An entry for the value takes precedence over the kind field.
  • Code changed the kind field on the same record. The label reads the kind field when a value arrives, that is, on a record change; it doesn't see a later change made by code on the same record.
  • New record, report, UserForm. There, the designed Kind applies, and KindField isn't read.
  • The detail section of a continuous form. Access creates only one instance there, which shows only the current record, and a bound one keeps Access from opening the form.

Resolution

  1. Set Control Source to the field or expression, and set NullText for empty values.
  2. Add one entry per value with AddStatusItem (in Design view, so that they're stored with the form); check them with StatusItemCount.
  3. Store a kind the label understands in the kind field, or add entries instead.
  4. After code changes the kind field of the current record, call Refresh.
  5. For a status per record of a list, use a status column of WklGrid (wedStatus) instead of a label in a continuous form.

See also How to: Show a status from a field of the record.

en/wiki/msaccess/comctl/troubleshooting/status-label-shows-nothing.txt · Zadnja sprememba: uporabnika Wolfgang van der Stille