Color scheme: Dark
You are here: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library API reference » WklKpiCard

WklKpiCard

WklKpiCard class

Signature

Dim myWklKpiCard As WklKpiCard
Set myWklKpiCard = Me!ControlName.Object

Summary

A key figure for a start page: title, value with unit, the deviation from a comparison value, a status, a sparkline and a badge; clickable like a tile.

Parameters

None

Remarks

Use one card per figure that may need action: open sessions, keys that expire, refused log-ons. A click (Clickable) opens the list behind the figure; Key tells the Click procedure which one.

Fill it like a status label: unbound, code sets Value, Compare and the points of the sparkline (AddPoint, SetSeries), for example from a timer; bound, Control Source names a field or expression for Value. The deviation Value - Compare is drawn with an arrow in the text color of DeltaKind: whether more is good is the application's decision, not the card's. StatusText adds a pill under the title and a strip in the strong color of StatusKind along the left edge.

The card is not a live region: on a start page that refreshes every few seconds, announcing every change would talk over everything else. Screen readers read the statement (Statement) when they reach the card; a clickable card is a button with the Invoke action.

An ActiveX control: inserted into a form in design view (Form Design › Controls › ActiveX Controls); reports are not supported. VBA reaches it through the Object property of the control, where ControlName is the name of the control on the form.

MemberKindSummary
`Value`PropertyGets or sets the figure.
`Title`PropertyGets or sets the title.
`Unit`PropertyGets or sets the unit after value and deviation.
`Format`PropertyGets or sets the format of the value.
`Subtitle`PropertyGets or sets a line under the value.
`Compare`PropertyGets or sets the comparison value.
`DeltaKind`PropertyGets or sets the kind of the deviation, which sets its color.
`DeltaFormat`PropertyGets or sets the format of the deviation.
`ShowSparkline`PropertyGets or sets whether the sparkline is shown.
`SparkColumns`PropertyGets or sets whether the sparkline is drawn as columns.
`Points`PropertyGets or sets how many points the sparkline keeps.
`AddPoint`MethodAppends a point to the sparkline.
`SetSeries`MethodReplaces the points of the sparkline.
`ClearPoints`MethodRemoves all points of the sparkline.
`PointCount`PropertyGets the number of points in the sparkline.
`BadgeCount`PropertyGets or sets the count in the top right corner.
`BadgeKind`PropertyGets or sets the kind of the badge.
`Clickable`PropertyGets or sets whether the card behaves like a tile.
`BackColor`PropertyGets or sets the background color.
`ForeColor`PropertyGets or sets the text color.
`FontName`PropertyGets or sets the font.
`FontSize`PropertyGets or sets the font size of the title, in points.
`Statement`PropertyGets the statement screen readers hear.
`StatusText`PropertyGets or sets the status of the card.
`StatusKind`PropertyGets or sets the kind of the status, which sets the colors of its pill and of the strip on the left edge.
`Key`PropertyGets or sets the key that Click passes on.
`ColorScheme`PropertyGets or sets the color scheme the control draws in.
EventSummary
`Click`Occurs when the user clicks the card; for a Clickable card also on Enter or Space while it has the focus, and when a screen reader invokes it.

Code example

Private Sub Form_Load()
    With Me!kpiLocked.Object
        .Title = "Gesperrte Personen"
        .Key = "locked"
        .Clickable = True
    End With
    RefreshCards
End Sub
 
Private Sub RefreshCards()
    With Me!kpiLocked.Object
        .Compare = .Value
        .Value = DCount("*", "tblPerson", "Status = 'gesperrt'")
        .DeltaKind = IIf(.Value > .Compare, wskBad, wskNeutral)
        .StatusText = IIf(.Value > 0, "Action needed", "")
        .StatusKind = wskBad
        .AddPoint .Value
    End With
End Sub
 
Private Sub kpiLocked_Click(ByVal Key As String)
    DoCmd.OpenForm "frmPeople", , , "Status = 'gesperrt'"
End Sub

Inheritance

None

Value property

Signature

Property Get Value() As Variant
Property Let Value(RHS As Variant)

Summary

Gets or sets the figure.

Parameters

None

Property value: Variant – A number, or Null for no value (“–”).

Remarks

Text and other values raise wkeInvalidValue; an empty text counts as Null.

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

Title property

Signature

Property Get Title() As String
Property Let Title(RHS As String)

Summary

Gets or sets the title.

Parameters

None

Property value: String – A text, for example “Open sessions”.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

Unit property

Signature

Property Get Unit() As String
Property Let Unit(RHS As String)

Summary

Gets or sets the unit after value and deviation.

Parameters

None

Property value: String – A text; empty for none.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

Format property

Signature

Property Get Format() As String
Property Let Format(RHS As String)

Summary

Gets or sets the format of the value.

Parameters

None

Property value: String – An Access format; empty for the general format.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

Subtitle property

Signature

Property Get Subtitle() As String
Property Let Subtitle(RHS As String)

Summary

Gets or sets a line under the value.

Parameters

None

Property value: String – A text, for example “seit 08:00”; empty for none.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

Compare property

Signature

Property Get Compare() As Variant
Property Let Compare(RHS As Variant)

Summary

Gets or sets the comparison value.

Parameters

None

Property value: Variant – A number, or Null (default) for no deviation.

Remarks

The deviation is Value - Compare, drawn as “▲ +5”, “▼ −3” or “= 0”; screen readers hear “plus 5 compared with 37”.

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

DeltaKind property

Signature

Property Get DeltaKind() As WklStatusKind
Property Let DeltaKind(RHS As WklStatusKind)

Summary

Gets or sets the kind of the deviation, which sets its color.

Parameters

None

Property value: `WklStatusKind` – A `WklStatusKind` constant; the default is wskNeutral.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

DeltaFormat property

Signature

Property Get DeltaFormat() As String
Property Let DeltaFormat(RHS As String)

Summary

Gets or sets the format of the deviation.

Parameters

None

Property value: String – An Access format; empty for the format of the value with a sign. A format with sections such as “+0;-0” writes its own sign.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

ShowSparkline property

Signature

Property Get ShowSparkline() As Boolean
Property Let ShowSparkline(RHS As Boolean)

Summary

Gets or sets whether the sparkline is shown.

Parameters

None

Property value: Boolean – True (default) or False.

Remarks

The sparkline takes the room under value and subtitle; on a card too low for it, it is left out.

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

SparkColumns property

Signature

Property Get SparkColumns() As Boolean
Property Let SparkColumns(RHS As Boolean)

Summary

Gets or sets whether the sparkline is drawn as columns.

Parameters

None

Property value: Boolean – True for columns; False (default) for a line.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

Points property

Signature

Property Get Points() As Long
Property Let Points(RHS As Long)

Summary

Gets or sets how many points the sparkline keeps.

Parameters

None

Property value: Long – 2 to 1000; the default is 20. Older points drop out first.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

AddPoint method

Signature

Sub AddPoint(ByVal Value As Variant)

Summary

Appends a point to the sparkline.

Parameters

NameTypeOptionalDefaultDescription
ValueVariantNo–A number, or Null for a gap.

Remarks

The points belong to the running form and are not saved with it. A value that is no number raises wkeInvalidValue.

Code example

None

Inheritance

Declared by WklKpiCard.

SetSeries method

Signature

Sub SetSeries(ByVal Values As Variant)

Summary

Replaces the points of the sparkline.

Parameters

NameTypeOptionalDefaultDescription
ValuesVariantNo–An array of numbers (Null for gaps), for example Array(30, 34, 33, 38); the newest Points are kept.

Remarks

None

Code example

None

Inheritance

Declared by WklKpiCard.

ClearPoints method

Signature

Sub ClearPoints()

Summary

Removes all points of the sparkline.

Parameters

None

Remarks

None

Code example

None

Inheritance

Declared by WklKpiCard.

PointCount property

Signature

Property Get PointCount() As Long

Summary

Gets the number of points in the sparkline.

Parameters

None

Property value: Long – The number of points.

Remarks

Read-only.

Code example

None

Inheritance

Declared by WklKpiCard.

BadgeCount property

Signature

Property Get BadgeCount() As Long
Property Let BadgeCount(RHS As Long)

Summary

Gets or sets the count in the top right corner.

Parameters

None

Property value: Long – 0 (default) hides it; a negative count raises wkeInvalidValue.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

BadgeKind property

Signature

Property Get BadgeKind() As WklStatusKind
Property Let BadgeKind(RHS As WklStatusKind)

Summary

Gets or sets the kind of the badge.

Parameters

None

Property value: `WklStatusKind` – A `WklStatusKind` constant; the default is wskBad.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

Clickable property

Signature

Property Get Clickable() As Boolean
Property Let Clickable(RHS As Boolean)

Summary

Gets or sets whether the card behaves like a tile.

Parameters

None

Property value: Boolean – True: hand pointer, border under the mouse, a tab stop, and Enter, Space and screen readers raise Click; False (default).

Remarks

Click occurs on a mouse click in either case.

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

BackColor property

Signature

Property Get BackColor() As OLE_COLOR
Property Let BackColor(RHS As OLE_COLOR)

Summary

Gets or sets the background color.

Parameters

None

Property value: OLE_COLOR – A color number; the default is the window background.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

ForeColor property

Signature

Property Get ForeColor() As OLE_COLOR
Property Let ForeColor(RHS As OLE_COLOR)

Summary

Gets or sets the text color.

Parameters

None

Property value: OLE_COLOR – A color number; the default is the window text color.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

FontName property

Signature

Property Get FontName() As String
Property Let FontName(RHS As String)

Summary

Gets or sets the font.

Parameters

None

Property value: String – A font name; the default is “Segoe UI”.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

FontSize property

Signature

Property Get FontSize() As Long
Property Let FontSize(RHS As Long)

Summary

Gets or sets the font size of the title, in points.

Parameters

None

Property value: Long – 6 to 72; the default is 9. The value is drawn larger.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

Statement property

Signature

Property Get Statement() As String

Summary

Gets the statement screen readers hear.

Parameters

None

Property value: String – For example “Open sessions: 42, plus 5 compared with 37, Action needed, 3 errors”.

Remarks

Read-only.

Code example

None

Inheritance

Declared by WklKpiCard.

StatusText property

Signature

Property Get StatusText() As String
Property Let StatusText(RHS As String)

Summary

Gets or sets the status of the card.

Parameters

None

Property value: String – A text such as “Action needed” or “Notice”; empty (default) for none.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

StatusKind property

Signature

Property Get StatusKind() As WklStatusKind
Property Let StatusKind(RHS As WklStatusKind)

Summary

Gets or sets the kind of the status, which sets the colors of its pill and of the strip on the left edge.

Parameters

None

Property value: `WklStatusKind` – A `WklStatusKind` constant; the default is wskNeutral.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

Key property

Signature

Property Get Key() As String
Property Let Key(RHS As String)

Summary

Gets or sets the key that Click passes on.

Parameters

None

Property value: String – A text, for example the name of the list a click opens; empty by default.

Remarks

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

ColorScheme property

Signature

Property Get ColorScheme() As WklColorScheme
Property Let ColorScheme(RHS As WklColorScheme)

Summary

Gets or sets the color scheme the control draws in.

Parameters

None

Property value: `WklColorScheme` – wcoAutomatic (default), wcoLight, wcoDark or wcoHighContrast.

Remarks

wcoAutomatic follows, in this order, Windows high contrast mode, then the color set of the database design (Access: Design › Themes or Colors), and draws light when the database has no design or the control is on an Excel or Word UserForm. Office's own design setting and the Windows app mode are not followed: a database looks the same on every PC. In high contrast mode the control always uses the system colors. The scheme colors background and text (while BackColor and ForeColor keep the system defaults), the border, the subtitle, the deviation and the sparkline; a BackColor you set wins over the scheme. Every text keeps a contrast of at least 4.5:1. The control reads the database design after it is first drawn, never while Access draws the form, and again when the form opens anew. The value is saved with the form.

Read/write.

Code example

None

Inheritance

Declared by WklKpiCard.

Click event

Signature

Event Click(ByVal Key As String)

Summary

Occurs when the user clicks the card; for a Clickable card also on Enter or Space while it has the focus, and when a screen reader invokes it.

Parameters

NameTypeOptionalDefaultDescription
KeyStringNo–The value of Key.

Remarks

In a form module: Private Sub <ControlName>_Click(...). Parameters passed by reference can be changed by the procedure.

Code example

None

Inheritance

Declared by WklKpiCard.

en/wiki/msaccess/comctl/api-reference/wklkpicard.txt · Last modified: by Wolfgang van der Stille