Name Property
Sets or returns a user-defined name for a DAO object. For an object not appended to a collection, this property is read/write.
Settings and Return Values
The setting or return value is a String that specifies a name. The name must start with a letter. The maximum number of characters depends on the type of object Name applies to, as shown in Remarks. It can include numbers and underscore characters ( _ ) but can't include punctuation or spaces.
Remarks
TableDef, QueryDef, Field, Index, User, and Group objects can't share the same name with any object in the same collection.
The Name property of a Recordset object opened by using an SQL statement is the first 256 characters of the SQL statement.
You can use an object's Name property with the Visual Basic for Applications Dim statement in code to create other instances of the object.
Note For many of the DAO objects, the Name property reflects the name as known to the Database object, as in the name of a TableDef, Field, or QueryDef object. There is no direct link between the name of the DAO object and the object variable used to reference it.
The read/write usage of the Name property depends on the type of object it applies to, and whether or not the object has been appended to a collection. In an ODBCDirect workspace, the Name property of an appended object is always read-only. The following table indicates whether the Name property in a Microsoft Jet workspace is read/write or read-only for an object that is appended to a collection (unless otherwise noted), and also indicates its maximum length in cases where it is read/write.
Object | Usage | Maximum length |
---|---|---|
Container | Read-only | |
Connection | Read-only | |
Database | Read-only | |
Document | Read-only | |
Field | ||
Unappended | Read/write | 64 |
Appended to Index | Read-only | |
Appended to QueryDef | Read-only | |
Appended to Recordset | Read-only | |
Appended to TableDef (native) | Read/write | 64 |
Appended to TableDef (linked) | Read-only | |
Appended to Relation | Read-only | |
Group | ||
Unappended | Read/write | 20 |
Appended | Read-only | |
Index | ||
Unappended | Read/write | 64 |
Appended | Read-only | |
Parameter | Read-only | |
Property | ||
Unappended | Read/write | 64 |
Appended | Read-only | |
Built-in | Read-only | |
QueryDef | ||
Unappended | Read/write | 64 |
Temporary | Read-only | |
Appended | Read/write | 64 |
Recordset | Read-only | |
Relation | ||
Unappended | Read/write | 64 |
Appended | Read-only | |
TableDef | Read/write | 64 |
User | ||
Unappended | Read/write | 20 |
Appended | Read-only | |
Workspace | ||
Unappended | Read/write | 20 |
Appended | Read-only |