Windows has a number of controls that you can access through ActiveX controls. Nine ActiveX controls are available with Comctl32.ocx, which is automatically registered when you install the Microsoft Office Developer (MOD). Table 14.1 lists the controls available.
Note
A number of other ActiveX controls are included in the MOD. The controls listed in Table 14.1 are the ones described in this chapter.
The native Access Tab control now performs the tasks that the ActiveX TabStrip control accomplishes. However, because this chapter is on ActiveX controls, the TabStrip control is also discussed.
With the TabStrip control, you can create a tabbed form with multiple rows. All you have to do is set the MultiRow property to true. Figure 14.1 shows an example of multiple tab rows created with the TabStrip control.
The TabStrip control also allows you to display images on the tabs. In Figure 14.1, you can see the ImageList control that specifies the list of images to use. The actual images are stored in another Windows Common Control—the ImageList control.
To specify a list of images, insert an ImageList control onto a form in which you have a TabStrip control. Then open the ImageList control-specific property sheet and select the Images tab. You can then choose Insert Picture and add a list of images. Figure 14.2 shows a list of selected images.
Again, after you create the image list, you can then do the following:
1. |
Open the TabStrip control-specific property sheet. |
2. |
Set the ImageList property on the TabStrip control to the name of the ImageList control. |
3. |
Select the Tabs tab on the property sheet. |
4. |
For the Image property for each tab, set the value to the corresponding image index. The ListView image is 1, the Slider image is 2, the Progress image is 3, and so forth. |
The images now appear on each tab.
Tip
You can also use the ImageList control with the ListView, ToolBar, and TreeView controls.
For more information on how to use the ImageList control, see the later section “Taking a Closer Look at the ImageList Control.”
Using the Access Tab control and ActiveX TabStrip control in VBA is basically the same, except that different properties are used and that the routines are attached to different events. When using the Tab control, the default Value property is used; the TabStrip control, on the other hand, uses the SelectedItem.Index property.
Listing 14.1 shows the code used for the Access Tab control and attached to the Change event.
Note
The code in Listing 14.1 is displayed here, but is not in the sample database because the Access Tab control is usually used. The code is presented here to show how to use the TabStrip control with VBA, when you use it with other languages such as Visual Basic.
Listing 14.2 shows the same code used with the TabStrip control. Notice that you attach it to the Click event. Also notice that instead of Value, you look at SelectedItem.Index.
In the end, with Access, you will want to use the standard Access tab control.
For more information on paging techniques in multiple forms, see Chapter 9, “Creating Powerful Forms.”
18.191.60.249