Name Property

See Also1A9WUQ1

Applies To

All forms and controls, Database object,P8AHA Dynaset object,25TLT8 Field object,KU5EEE Index object,1WDWMJT QueryDef object,DFCEMQ Snapshot object,HBYSUX Table object,5RHH0MW TableDef object.K497U

Description

Specifies the name used in code to identify a form, control, or data access object.  Not available at run time.

Remarks

The default name for new objects is the kind of object plus a unique integer.  For example, the first new form is "Form1," a new MDI form is "MDIForm1," and the third text box you create on a form is "Text3."

An object's Name property must start with a letter and can be a maximum of 40 characters.  It can include numbers and underscore characters but can't include punctuation or spaces.  Forms can't have the same name as another global object such as Clipboard, Screen, or App.  However, unlike Visual Basic 1.0, a name can be the same as a reserved word43US84, property name, or the name of another object, but this can create conflicts in your code.  For information on handling naming conflicts, see Chapter 6, "Programming Fundamentals," in the Programmer's Guide.

You can use a form's Name property with the DimLANDIM statement in code to create other instancesCN50HF of the form.

You can't have two forms at design time with the same name.  You can create an array of controls of the same type by setting the Name property to the same value.  For example, when you set the name of all option buttons in a group to "MyOpt," Visual Basic assigns unique values to the Index3MKW18P property of each control to distinguish it from others in the array.  Two controls of different types can't share the same name.

 

Note   Although Visual Basic often uses the Name property as the default value for the CaptionF6ZZXB, LinkTopicEVWV3S, and Text14TWSRU properties, changing one does not affect the others.

For many of the Database objects, the Name property reflects the name as known to the Database, as in the name of a Table, Field, or QueryDef.  There is no direct link between the name of the Database object and the object variableZ3R9Q5 used to reference it.  The name of the Dynaset or Snapshot is either the Name property of a Table or QueryDef used to create it, or the SQL statement29F05E5 used to create it.

 

Data Type

String7WSH0XQ


See Also

Help:

ActiveForm PropertyGCUI9X

Caption PropertyF6ZZXB

Data Access11WWTV1

Dim StatementLANDIM

Index Property3MKW18P (Control Arrays)

Index PropertyH12OL9 (Data Access)

LinkTopic PropertyEVWV3S

Me Reserved WordLANME

Text Property14TWSRU

 

Programmer's Guide:

Chapter 3, "Creating and Using Controls"

Chapter 6, "Programming Fundamentals"

Chapter 20, "Accessing Databases with the Data Control"

 

Data Access Guide

Chapter 2, "Database Management Using Visual Basic"