Name 属性

重要:  本文是由机器翻译的,请参阅免责声明。请在 此处 中查找本文的英文版本以便参考。

适用于

AccessObject Object

CodeProject Object

Form Object

ObjectFrame Object

Reference Object

SubForm Object

AccessObjectProperty Object

ComboBox Object

Image Object

OptionButton Object

Report Object

TabControl Collection

AdditionalData Object

CommandButton Object

Label Object

OptionGroup Object

Section Object

TextBox Object

Application Object

CurrentProject Object

Line Object

Page Object

SmartTag Object

ToggleButton Object

BoundObjectFrame Object

CustomControl Object

ListBox Object

PageBreak Object

SmartTagAction Object

CheckBox Object

DataAccessPage Object

Module Object

Rectangle Object

SmartTagProperty Object

You can use the Name property to specify or determine the 字符串表达式 that identifies the name of an object. Read/write String for the following objects: AdditionalData, BoundObjectFrame, CheckBox, ComboBox, CommandButton, CustomControl, Form, Image, Label, Line, ListBox, Module, ObjectFrame, OptionButton, OptionGroup, Page, PageBreak, Rectangle, Report, Section, SmartTagProperty, SubForm, TabControl, TextBox, and ToggleButton. Read-only String for the following objects: AccessObject, AccessObjectProperty, Application, CodeProject, CurrentProject, DataAccessPage, Reference, SmartTag, and SmartTagAction.

expression.Name

expression Required. An expression that returns one of the above objects.

备注

A valid name must conform to the standard naming conventions for Microsoft Office Access 2007. For Microsoft Access objects, the name may be up to 64 characters long. For controls, the name may be as long as 255 characters.

For new objects, set the Name property by clicking Save on the Quick Access Toolbar and entering a valid name. To change the name of an existing object in the Navigation pane, right-click the name, then click Rename. To change the name of an existing object when the object is open, click Save As on the Quick Access Toolbar.

For a section or control, you can set this property by using the 属性表, a 宏, or Visual Basic for Applications (VBA) code. You can use the Name property in expressions for objects.

The default name for new objects 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 系统对象, such as the Screen object.

For an 未绑定控件, 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 绑定控件, 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, report, or data access page can't have the same name, but controls on different forms, reports or data access pages can have the same name. A control and a section on the same form can't share the same name.

示例

The following example returns the Name property for the first form in the Forms collection.

Dim strFormName As String

strFormName = Forms(0).Name

注意: 机器翻译免责声明:本文是由无人工介入的计算机系统翻译的。Microsoft 提供机器翻译是为了帮助非英语国家/地区用户方便阅读有关 Microsoft 产品、服务和技术的内容。由于机器翻译的原因,本文可能包含词汇、语法或文法方面的错误。

扩展你的技能
了解培训
抢先获得新功能
加入 Office 预览体验计划

此信息是否有帮助?

谢谢您的反馈!

谢谢你的反馈! 可能需要转接到 Office 支持专员。

×