Tab controls can be used to add extra space to a form or to group similar or related objects together. In this video, Adam shows how to add a tab control, how to add and arrange additional tab objects, and how to place objects within the tabs. Proper use of the tab control can effectively provide a significant increase in space available on a well-organized form.
- [Narrator] A TabControl can be used to add extra space to your form, or to group similar, or related objects together. Adding a TabControl is a great way to organize your form, but is not a control that you'll want to use on a report. Since most reports are printed out, you obviously wouldn't be able to click on the paper to change the tabs. Let's take a look at the TabControl on a form though. We're going to right-click on the Control's Form, and open that straight into Design View. Then, on the Design tab of the ribbon in the Controls group, we'll find the tab object right here. It's the one that looks like a file folder. So go ahead click on it to select it, and then I'll come down into my form and I'll drag out a rectangle to put in a new TabControl.
When I do that, we actually get a couple of different objects that are all grouped together. First, is the man TabControl itself, which is currently selected. I can see that by coming over here to the Property Sheet and I can see that the selection type is TabControl. Now, within the TabControl, we actually have the individual tabs or what Access calls pages. Mine are number Page6 and seven, you might actually have something different here. I click on each of these tabs, you'll notice that the selection changes to type Page. Then, go through and select Page6 here, and I can select Page7 there. In order to reselect the entire TabControl, the easiest way to do that is to click on the right hand side of the last tab.
This blank area right here. When I click there, it reselects the full TabControl. You can add additional tabs or additional pages into your TabControl by right-clicking on any of them and choosing Insert Page. That'll add in a third tab. In order to get rid of a tab, simply right-click on it and choose Delete Page. I can also rearrange the sequence of the pages. Simply right-click on the TabControl and come up here to Page Order. Now you might be confused here, there's actually another option called Tab Order, this is something completely different. The Tab Order controls the selection sequence when you press the Tab key on your keyboard.
What I want to do is readjust the ordering or the sequence here of these pages. So I'm going to go over and choose Page Order instead. This is where we can move pages up and down in the ordering. For instance, I'll take Page7, I'll move that up in the list, and say okay. You'll now see that it says Page7 first and then Page6 next. One of the properties that we can change here for the TabControl, let me go ahead and select that again. Is the background color or the shading color of the deselected tab. I can select here and come up to the Format Tab, and change the Shape Fill, right now you can see it says light gray color, but I can change it to any color that I like. For instance if I change it to this light green, you'll notice that that shaded changes to a green color instead.
I can also change the shape of the tab itself if I like. Go over here to Change Shape and you can choose from some of these options. For instance, I like this one here with these little corner snip out of the right hand corner. Notice, that changes the angle here of the corner of the tab. Next I want to change the texts that's appearing on each of these Tabs. Let's go ahead and select it here, and I'll click again to select this one, that I have currently says Page6. In order to change the text that appears on the Tab itself, I'm going to come over here to the Property Sheet and change its caption property. I'm going to call this Lines. That'll change the text on the tab. I'm going to go over and click on the one that says Page7 and I'm going to change its caption to Rectangles.
Now each tab creates multiple distinct zones for other objects, and each zone has its own design area. In order to add things into your tab, you want to make sure the tab is selected, and then I'll come over here to the Design Tab on the Ribbon up at the top. In the tab that says Rectangles, I'm just going to simply add in a rectangle object. So, I'll go here and I'll select my rectangle object and then I'll come down into my tab. You'll notice that as soon as I get in the area, the entire tab area turns black. That indicates that the next thing that I add is going to be added inside of this tab and not inside of the main body of the form itself.
So, let's come down into the Rectangle's tab. I'll just simply drag out a rectangle and I'll adjust its formatting so that we can see it. I'll change the Shape Outline to a blue color and the Shape Fill to a lighter blue. So there's my Rectangle tab. Let's switch over here to Lines tab. Go ahead and click on it a couple times to select it. Then, I'll come up here to the Designs Tab of the Ribbon and I'm going to add in a line control. I'll move into the tab. You'll notice it turns black again. I'll drag out a new line and once again I'll just change its formatting. I'll make it a little bit thicker as well.
So, now I have two tabs. One called Lines with a line object in it, and one called Rectangles with a rectangle object in it. If I were to take a look at how this works. I'll go ahead and switch over into the Form View and you'll see I have my two tab objects here. I can switch back and forth between the line objects and the rectangle objects within each individual tab. Now, one of the other common things you might want to do with tabs is have it respond to the width or the size of your end user's computer monitor. Once again, we could do that with the stretching options that we have inside of Anchoring. I'll go back into Design View. I'm going to select the entire TabControl by clicking over here on the right hand side of the last tab.
Then, we'll come up to the Arrange Tab and in Anchoring, I'm going to choose Stretch Down and Across. That'll force my TabControl to respond to the width of my monitor as well as the height. It'll anchor it so it's about and eighth of an inch here on the left hand margin, about an eighth of an inch on the right hand margin. Let me scroll down here. I'm actually going to take this form and make it a little bit shorter. So it's about an eighth of an inch from the bottom of my form. Let's go ahead and take a look at that in Form View. We'll see that my TabControl now responds to the full width of my monitor. Once again, I can switch back and forth between the Rectangles tab and the Lines tab.
So anything that you can add to your form, you can add inside of a tab. I'm just using lines and rectangles here as an example, but you can add buttons, text boxes, and entire sub forms. They can all live inside of that tab interface if it makes sense for your database's design. Tabs can add some dimension and organization to your forms when screen space is at a premium.
- Explore the components to a specific database.
- Identify the steps needed to create a form with the Form Wizard.
- Determine the steps to use when organizing the form elements.
- Examine the components of anchor control.
- Recognize the elements of modifying form properties.
- Identify the steps necessary for combining text boxes.
- Determine how to add a form header.
- Recognize the steps to take to organize screen space with tabs.
- Explore the ways to add data to a text box.
- Identify the essentials of a report’s structure.