The layout stays wide after the window shrinks
On a form with a WklDockLayout whose FillSection is False, the areas grow when the Access
window is enlarged, but when the window is made smaller again, they keep their larger width and a
horizontal scroll bar appears. Closing and reopening the form restores the designed width.
Environment
WKL Forms Object Library 1.23 and later; Access forms with FillSection = False and the layout
anchored in both directions, in Access in Microsoft 365 (32-bit) with forms displayed as tabbed
documents. FillSection = True (the default) and UserForms aren't affected.
Cause
With FillSection off, Access itself stretches the anchored layout when the window grows, and the
layout arranges its areas in that larger space. Areas that extend beyond the form's designed width
make Access widen the form (Form.Width) to contain them. When the window shrinks again, Access
keeps the anchored layout at the distance it had from the right edge of the now wider form, and it
won't narrow the form past the layout's right edge. Neither the layout nor code can shrink the form
back without changing the layout's position, and setting a position in code ends Access's anchoring
of that control. With FillSection on, the layout positions itself and narrows the form back to
the window at every size, so the problem doesn't occur.
Resolution
- Turn on
FillSection(on the Other tab of the property sheet, or with the Fill the whole area switch on the designer's Areas page). The layout then takes up the visible Detail section at every size; put controls that must stay visible next to the areas in the form header or footer. - Users who see the scroll bar can close and reopen the form; the remembered arrangement of the areas comes back, but the widened form doesn't.