The form becomes slow after handling NodeFormat or CellFormat
Expanding, scrolling, sorting, or filtering takes up to a second per step after FormatEvents was
turned on to handle NodeFormat or CellFormat.
Environment
All versions of WklTreeView and WklTreeList, Microsoft 365 Access.
Cause
NodeFormat occurs for every visible node, and CellFormat for every visible cell, on every
repaint. Access passes each ActiveX event call to the form, and each call costs a few
milliseconds, even when the procedure is empty, so a few hundred visible cells cost the better part
of a second per repaint. A DLookup call or a query inside the procedure multiplies the cost.
Resolution
- Move fixed formatting into the data with
ForeColorFieldandBoldField(tree) or format rules (FormatRules, tree list), which don't need an event. - Leave
FormatEvents = Falseunless the form handles the events. - If you need an event, keep queries out of the procedure: read the values you need once (for example, into a
DictionaryinForm_Load) and look them up there.
en/wiki/msaccess/comctl/troubleshooting/slow-formatting-events.txt · Zadnja sprememba: uporabnika Wolfgang van der Stille