Color scheme: Dark
You are here: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » Status and feedback » WklBadge

WklBadge

WklBadge puts a count or a dot on an Access button, label, image or text box, as Outlook and Teams mark unread items. The control sits next to its target in the same section and moves onto the chosen corner in form view.

Get started

Common tasks

Visual aid

+- frmStart: Form view ------------------------------------------------+
|                                                                      |
|   [ Sessions    ](3)          Notices (*)         [ Open       99+ ] |
|        1                          2                       3          |
+----------------------------------------------------------------------+
RegionMeaning
1An Access command button with a count badge on its top-right corner (Target = "cmdSessions", Corner = wbcTopRight)
2An Access label with a dot badge (Dot = True, Kind = wskInfo)
3A wide button with the count inside its right edge (Corner = wbcRightMiddle), above Max shown as “99+”

Key features

  • Any Access control as target (Target, Corner, OffsetX, OffsetY): the badge follows the target when code moves it, resizes it or hides it.
  • Count or dot (Count, Dot), with “99+” above Max and zero hidden (HideZero).
  • Bound like a text box: the Control Source sets the count per record, also an expression such as =DCount(...); the kind (color) per record from KindField. The badge never writes back and never makes the record dirty.
  • Never in the way: a click on the badge goes to the button below it, and the badge is no Tab stop (Clickable turns both around and raises Click).
  • Screen readers hear the full count with its subject (“Open sessions: 120”) and every change (AccessibleText, Announce).
  • The same pill as the badges of WklButton and WklNavBar; Windows high contrast respected.
  • Designer (row Custom [...]): target, corner, value rules and colors, with “Align to target” to place the badge in design view.

Core concepts

A control beside its target. Access controls cannot be given a badge, and VBA cannot draw on them, so the badge is a control of its own. In form view it looks for its target every 200 ms and moves itself through its own Left, Top, Width and Height, only when the place changed. In design view it stays where it was drawn.

Hidden without disappearing. A badge with nothing to show (zero, Null, a hidden target) cuts its window to nothing instead of setting Visible, so it reappears as soon as there is a count again.

Limits of the host. Access draws subforms over every ActiveX control, and the detail section of a continuous form holds one instance only. Put a badge beside a subform, and counts per record into a column of WklGrid.

Administration

Troubleshooting

For developers

en/wiki/msaccess/comctl/status-and-feedback/badge/start.txt · Last modified: by Wolfgang van der Stille