Computer Training & Application Solutions made Simple
Contact us for a free consultation
  • Click to send us an email. We'd love to hear from you!   Ottawa       613-656-4229
  • Click to send us an email. We'd love to hear from you!   Montreal    514-342-9494

Microsoft Access Naming Conventions

By Deborah J. Sparks

No matter which version of Access you're using, considering naming conventions for tables, queries, forms, reports, fields and controls is time well spent.

Let's say you've got two tables called Customers and Employees that both contain fields named LastName and FirstName.

When you begin to built objects that refer to the fields, which LastName and FirstName is which? You may also have a table, query, form and report all named Customers. More confusion for you - and for Access.

Below are some examples of naming conventions I use. You may decide on something a bit different, or may use two or three prefix characters, depending on how many tables you have in your database that may contain similar fields. 

The most important thing to keep in mind is that you use naming conventions and that they are consistent.


HIERARCHY OBJECTS

Tables tblEmployees
Queries qryOrderDetails
Forms qryOrders
Subforms frmOrdersSub OR frmOrdersSub1 (more than 1 subform)
Reports rptOrdersByClients

FIELD NAMES

tblCustomers tblEmployees
CustomerID (primary key) EmployeeID (primary key)
cFirstName eFirstName
cLastname eLastname
cAddress1 eAddress1
cAddress2 eAddress2
cEmployeeID (foreign key) eCustomerID (foreign key)

CONTROLS

Label lblSelectDate
Text box txtCompanyName
Combo box cboFullName
List box lstFullNames
Command button cmdCancel
Image imgLogo
Tab control tabEmployeeInfo

 

Do not use symbols and spaces. They cause all kinds of problems, so avoid them completely.

I prefer ‘camel case’, but you can also use the underscore character. For example: tlbCustomers or tbl_customers.

There are also reserved words that you cannot use, such as Month, Date and Name. For a complete list, view Allen Browne’s exhaustive list of reserved words at Problem names and reserved words in Access.

What’s in a name? Quite a bit, when it comes to Access!



More Newsletter Articles

© 2012 DJH Training & Application Solutions Inc.

WOULD YOU LIKE TO USE THIS ARTICLE IN YOUR NEWSLETTER, EZINE OR WEB SITE? You can, as long as you include this complete blurb with it: An entrepreneur at heart, Deborah J. Sparks established DJH Training & Application Solutions Inc. over 20 years ago, realizing her dream of creating a company known for providing high quality computer software training, application development and support and exercising her passion for teaching. To learn more and to register for DJH's free newsletter, Innovations, please visit www.djhsolutions.ca.