Caption Property [Access 2003 VBA Language Reference]

You can use the Caption property to provide helpful information to the user through captions on objects in various views:

  • Field captions specify the text for labels attached to controls created by dragging a field from the field list and serves as the column heading for the field in table or query Datasheet view.
  • Form captions specify the text that appears in the title bar in Form view.
  • Report captions specify the title of the report in Print Preview.
  • Button and label captions specify the text that appears in the control.

Read/write String.

expression.Caption

expression Required. An expression that returns one of the objects in the Applies To list.

Setting

The Caption property is a string expression that can contain up to 2,048 characters. Captions for forms and reports that are too long to display in the title bar are truncated.

For controls, you can set this property by using the property sheet . For fields, you can set this property by using the property sheet in table Design view or in the Query window (in the Field Properties property sheet ). You can also set this property by using a macro or Visual Basic .

Remarks

If you don't specify a caption for a table field, the field's FieldName property setting will be used as the caption of a label attached to a control or as the column heading in Datasheet view. If you don't specify the caption for a query field, the caption for the underlying table field will be used. If you don't set a caption for a form, button, or label, Microsoft Access will assign the object a unique name based on the object, such as "Form1".

If you create a control by dragging a field from the field list and haven't specified a Caption property setting for the field, the field's FieldName property setting will be copied to the control's Name property box and will also appear in the label of the control created.

Note  The text of the Caption property for a label or command button control is the hyperlink display text when the HyperlinkAddress or HyperlinkSubAddress property is set for the control.

You can use the Caption property to assign an access key to a label or command button. In the caption, include an ampersand (&) immediately preceding the character you want to use as an access key. The character will be underlined. You can press ALT plus the underlined character to move the focus to that control on a form.

Tip

Save && ExitCaption

Applies to | CommandButton Object | Form Object | Label Object | Page Object | Report Object | ToggleButton Object

See Also | HyperlinkAddress Property | Name Property