Color scheme: Light
You are here: start » en » Documentation » Microsoft Access development tools » WKL Forms Object Library » WKL Forms Object Library troubleshooting » The form becomes slow after handling NodeFormat or CellFormat

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

  1. Move fixed formatting into the data with ForeColorField and BoldField (tree) or format rules (FormatRules, tree list), which don't need an event.
  2. Leave FormatEvents = False unless the form handles the events.
  3. If you need an event, keep queries out of the procedure: read the values you need once (for example, into a Dictionary in Form_Load) and look them up there.
en/wiki/msaccess/comctl/troubleshooting/slow-formatting-events.txt · Last modified: by Wolfgang van der Stille