From the course: Access 2016: Forms and Reports

Anchor controls

From the course: Access 2016: Forms and Reports

Start my 1-month free trial

Anchor controls

- [Voiceover] When creating forms in an Access database, you'll need to be aware of how the layout will change when you view them on computers with different size screens. By anchoring objects to the edges of your screen, your forms can better respond to a shift in scale. Let's take a look at that in our Employee Directory, and I'll switch it into Design View. Now, you can apply anchoring to any object on your form and the behavior will be the same. To explore what the options are, though, let's go ahead and add in a simple button object by coming up to the Design tab, and grabbing this object here. It's the rectangle with the four Xs in it. I'll click on it once to grab the button, and then, you'll notice that my cursor has changed to indicate that the next thing I do is gonna add the button to my form. I'll go ahead and click once to add the button, and then I'll press Cancel to dismiss the Command Button Wizard. We'll talk extensively about adding various objects, including buttons, later on in the course, but for now, I just want to have something to play around with. Let's go ahead and click and drag on this button to move it to the upper left-hand corner of the screen. Underneath the Arrange tab, we'll find the Anchoring options here, and you'll notice that we have nine options. Let's first focus on the corner options, the Top Left, Top Right, Bottom Right, and Bottom Left options. By default, every object that you add is gonna get anchored to the top left-hand side of the screen, and basically, what that means, is that it's gonna maintain a relationship between the top edge of your form, here, and the top edge of your item, as well as the left-hand edge of the form to the left-hand edge of your item. In this case, if I go into the Design View, and switch my view into Form view, you'll notice that that button gets put exactly where I thought it would go. Let's switch our view back to Design view. Now, if I wanted to place this button in the upper right-hand corner of my form by moving it over here, you'll notice what happens. If I switch my view back, you'll notice that my button is right over here, but it's a long ways away from the right-hand side of my screen. In order to lock the button position into the upper right-hand corner of my screen, what I can do is go into Design view, go to the Arrange tab, and change its anchoring over here to the Top Right corner. Now, the distance between the top and the top of my button, and the right-hand edge and the right side of my button is gonna be maintained, and it'll move the button over depending on the width of my screen. Once again, we'll switch our view to Form view and you'll notice that button now is stuck to the right-hand side of the screen. Let's switch our view back, and we'll move our button to the bottom right-hand corner. Again, if I switch my view without changing the anchoring, it's gonna maintain the relationship between the right-hand edge of my screen and the right-hand edge of my button, and the top of the screen and the top of the button. So, now you see my button is kind of floating here in the middle of the screen. We could change that again, by going to Design view. We'll go to Arrange, and change our anchoring to Bottom Right, and now it'll maintain the position to the bottom right-hand corner of our form. We'll switch our view again, and we'll see the result of that change. Now, no matter what size screen my users are using, that button will always appear in the far, bottom, right-hand corner of the screen. Let's switch our view back to Design view and look at the other options that we had. Back on the Arrange tab in the Anchoring section, we have these options here that say Stretch. Stretch Across Top, Stretch Down, Stretch Down and Across, Down and Right, and Stretch Across the Bottom. What these options do is lock the position to multiple edges. For instance, if I say stretch across the top, what it's going to do is maintain the position from the top of the form to the top of my button, and from the left-hand side of my form to the left-hand side of my button, and the right-hand side of my form, and the right-hand side of my button. Let's make that change and go into the Design tab, switch over to Form view, and you'll see the results. Now, my button has to stretch its width in order to maintain those three relationships at the same time. This could be useful for applying to text boxes so they take up the full width of the screen. So, being aware of how anchoring works, and taking advantage of the options that are available while designing your forms will ensure that your forms maintain a consistent appearance regardless of what size screen your end users are viewing them on.

Contents