Guidelines for naming fields, controls, and objects

Applies to: Access for Office 365, Access 2019, Access 2016, Access 2013, Access 2010, Access 2007.

Note: The functionality explained in this article does not apply to “Access web apps” and “Access web databases.” For more information about working with Access web apps, please see create an Access app.

Names of fields, controls, and objects in Microsoft Access desktop databases:

  • Can be up to 64 characters long.
  • Can include any combination of letters, numbers, spaces, and special characters except a period (.), an exclamation point (!), an accent grave (`), and brackets ([ ]).
  • Can’t begin with leading spaces.
  • Can’t include control characters (ASCII values 0 through 31).
  • Can’t include a double quotation mark (“) in table, view, or stored procedure names in a Microsoft Access project.

Although you can include spaces in field, control, and object names, much examples in the Microsoft Access documentation show field and control names without spaces because spaces in names can produce naming conflicts in Microsoft Visual Basic for Applications in some circumstances.

Once you name a field, control, or object, it’s a sensible idea to make sure the name doesn’t duplicate the name of a property or other element used by Microsoft Access; otherwise, your database can produce unorthodox behaviour in some circumstances. For example, if you refer to the value of a field called Name in a table NameInfo using the syntax NameInfo.Name, Microsoft Access displays the value of the table’s Name property rather than the value of the Name field.

Another way to evade unforeseen outcomes is to always use the ! operator instead of the . (dot) operator to refer to the value of a field, control, or object. For example, the following identifier explicitly refers to the value of the Name field rather than the Name property:

[NameInfo]![Name]

Leave a Reply

%d bloggers like this: