Tag Property

Applies To

CommandBarButton object, CommandBarComboBox object, CommandBarControl object, CommandBarPopup object.

Description

Returns or sets information about the command bar control, such as data that can be used as an argument in procedures, or information that identifies the control. Read/write String.

See Also

FindControl method.

Specifics (Microsoft Access)

In Microsoft Access 97, you can use the Toolbar Control Properties dialog box for command bar controls to set the Tag property for a control on a command bar. Display the Customize dialog box by pointing to Toolbars on the View menu and clicking Customize. For menu bar and toolbar controls, display the menu bar or toolbar, and then right-click the control whose Tag property you want to set. For shortcut menu controls, select the Shortcut Menus check box on the Toolbars tab of the Customize dialog box, then find the shortcut menu control you want on the menu bar that's displayed and right-click the control. Click the Properties command. Enter the information you want in the Tag box.

Example

This example moves the first combo box control from the custom command bar named "My Custom Bar" to the position before the seventh control on the command bar, sets the tag to "selection box," and assigns the control a high priority so that it will likely be dropped from the command bar if the controls don't all fit in one row.

Set allControls = CommandBars("My Custom Bar").Controls
For Each ctrl In allControls
    If ctrl.Type = msoControlComboBox Then
        With ctrl
            .Move Before:=7
            .Tag = "Selection box"
            .Priority = 5
        End With
        Exit For
    End If
Next