Name Property

Applies To

ActiveX control, Bound Object Frame control, Chart control, Check Box control, Combo Box control, Command Button control, Form, Form section, Image control, Label control, Line control, List Box control, Module object, Modules collection, Option Button control, Option Group control, Page, Page Break control, Rectangle control, Reference object, Reference object (Extensibility Object Model), Report, Report section, Subform/Subreport control, Tab control, Text Box control, Toggle Button control, Unbound Object Frame control.

Description

You can use the Name property to specify or determine the string expression that identifies the name of a form, report, section, control, or Reference object.

Setting

A valid name must conform to the object-naming rules for Microsoft Access. For forms and reports, the name may be up to 64 characters long. For controls, the name may be as long as 255 characters.

For forms and reports, set the Name property by clicking Save on the File menu in Design view and entering a valid name. To change the name of an existing form or report in the Database window, click the name, then either click Rename on the Edit menu or click the name again. You can also change the name by right-clicking it and clicking Rename on the shortcut menu. To change the name of an existing form or report when the object is open, click Save As/Export on the File menu.

For a section or control, you can set this property by using the property sheet, a macro, or Visual Basic. You can use the Name property in expressions for forms and reports.

You can set this property only in Design view.

Note   For a Reference object, this property is read-only in all views.

Remarks

The default name for new forms and reports is the object name plus a unique integer. For example, the first new form is Form1, the second new form is Form2, and so on. A form can't have the same name as another system object, such as the Screen object.

For an unbound control, the default name is the type of control plus a unique integer. For example, if the first control you add to a form is a text box, its Name property setting is Text1.

For a bound control, the default name is the name of the field in the underlying source of data. If you create a control by dragging a field from the field list, the field's FieldName property setting is copied to the control's Name property box.

You can't use "Form" or "Report" to name a control or section.

Controls on the same form or report can't have the same name, but controls on different forms or reports can have the same name. A control and a section on the same form can't share the same name.

See Also

Name property ("DAO Language Reference"), Screen object.