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
Actionevent goes to theWklToastobject that showed the note, and VBA delivers events only to a variable declaredWithEventsat the module level of a form, report, or class module. A note shown by a local variable (Dim note As New WklToastin 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_ActionforPrivate 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,ShowraiseswkeNotAvailable, and no note appears. - The note was closed with its form. A note shown with
Formcloses when that form closes (ClosedwithwtrOwnerClosed).
Resolution
- Keep the object at the module level:
Private WithEvents mToast As WklToast, created inForm_Load, and choosemToastandActionin the lists at the top of the code window so that VBA writes the procedure header. - 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. - Show notes that must outlive a form without
Form, so that they appear in the Access window.
Related topics
en/wiki/msaccess/comctl/troubleshooting/note-action-does-nothing.txt · Last modified: by Wolfgang van der Stille