applied tips : may 2009
microsoft access : automatically resizing forms
With Access 2007, Microsoft introduced a new feature that allows forms to automatically resize themselves on larger monitors. This feature finally lets Access designers take advantage of larger displays while staying compatible with smaller ones.
Consider the two screen captures below:
Both of these are the same exact form, but displayed on different monitors. You'll see that the second form, with a larger screen, takes advantage of that screen by making the Notes field far larger.
Resizing forms automatically don't have to just be for giant Notes fields. They were great for continuous subforms that can show more rows of data on larger displays.
Understanding Automatic Resizing (Anchoring)
This new feature is technically called Anchoring, and basically you're telling Access that for any selected Control on the form (a text box, list box, sub form, even line) you want it to "anchor" the corners of the control relative to the size of the form.
So, a Notes field like above with Anchoring set to "Stretch Down and Across" will do just that. The lower-right corner of the Notes field will grow with the form, using up all available space down and across.
Select an object, and from the Form Design Tools - Arrange tab in the Ribbon, look for the Anchoring pull-down gallery.
Choose any of the eight options to apply that style of anchoring to your selected object. Here's what they do:
- Top Left - This is the default setting. Your control will stay exactly where you have it, and won't be doing any stretching.
- Stretch Across Top - The "top" part of this is misleading. It will not move vertically, but it will stretch all the way to the right from where you have it position. This is good for a form title, or a subform that needs static height but would benefit from dynamic width.
- Top Right - This positions the control in the upper-right corner of the form, wherever that happens to be. This is excellent for command buttons!
- Stretch Down - Excellent for vertical continuous subforms, notes fields, and vertical lines, this will pull the bottom of the control down to the bottom of the form.
- Stretch Down and Across - This is a typical setting for notes fields, as it will stretch the selected control all the way down and across to the right edge.
- Stretch Down and Right - This will keep the control on the right-side of the form, but stretch it all the way down to the bottom.
- Bottom Left - This positions the control in the lower-left most corner of the form, and does no stretching.
- Stretch Across Bottom - This positions the control on the bottom of the form, then stretches it to the right.
- Bottom Right - This positions the control in the bottom-right corner of the form, wherever that happens to be. This, too, is excellent for command buttons!
The distance that a control will stretch, and how far it will move, is based relative to where it is located while in design mode. This can create some unusual effects but gives you more flexibility.
For example, take a look at this form in design mode:
You'll notice that the form has about 1" of unused space on the far right. If we select the Notes field and set it to "Stretch Down and Right", it will leave a 1" gap on the far right of the form no matter what size the window is. This is because we've designed it that way. If we adjust the width of the form so that the gap is removed, "Stretch Down and Right" will go all the way to the bottom and right.
Once you dig into the Anchoring feature, it's easy to lose track of what you've configured and have some poorly-behaving forms
If things get out of hand, simply select all of your controls and reset them to "Top Left". Then, one at a time, adjust their anchoring style until you reach the desired effect.
schedule a class or get consulting on access
Request an on-site Access class from Applied Office or get some helpful consulting. Learn more here
upcoming classes in Stockton, CA
Applied Office is offering hands-on classes in June and July in Stockton, CA starting at just $45, or $185 for a full day! Learn more here