Color scheme: Light
You are here: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library troubleshooting » A note's action does nothing, or no note appears

A note's action does nothing, or no note appears

Environment

WklToast 1.34 or later, in Access and on Excel and Word UserForms.

Cause

  • The object that showed the note is gone. The Action event goes to the WklToast object that showed the note, and VBA delivers events only to a variable declared WithEvents at the module level of a form, report, or class module. A note shown by a local variable (Dim note As New WklToast in a procedure that has ended) raises events that go nowhere.
  • The handler has the wrong name. The procedure must be named after the variable: mToast_Action for Private WithEvents mToast As WklToast.
  • No window for the note. Without Form, the note needs the Access window (or, in other hosts, an active window); when there isn't one, Show raises wkeNotAvailable, and no note appears.
  • The note was closed with its form. A note shown with Form closes when that form closes (Closed with wtrOwnerClosed).

Resolution

  1. Keep the object at the module level: Private WithEvents mToast As WklToast, created in Form_Load, and choose mToast and Action in the lists at the top of the code window so that VBA writes the procedure header.
  2. Where no module listens (a standard module, a procedure that ends), name a function in the last argument of Show, ActionFunction, for example "=RestoreRule(17)"; Access evaluates it when the user chooses the action, whatever has become of the object. An error in the expression appears in a message box, as it does for a menu entry.
  3. Show notes that must outlive a form without Form, so that they appear in the Access window.
en/wiki/msaccess/comctl/troubleshooting/note-action-does-nothing.txt · Last modified: by Wolfgang van der Stille