Agee Software, Inc.

Access Naming Conventions

One of the easiest ways to keep development costs low is to use standard naming conventions for all objects in your database. This keeps you from having to look up the name property of each object before referring to it. It also lets you copy objects used in a previously developed application and globally replace names more easily.

A table should be named for the data it contains. For example, the table that contains info about customers should be named tblCustomer.

Keep names short, singular and descriptive without abbreviating. Did you name that table Customer, Customers, Cust, Csts, MyCustomers or CustomerList?

Avoid keywords, spaces and special characters.
Keywords mean something different in Access. Avoid Name, Length, Size, Top, Left, Width, Form, First, Last, Row, Column, Value, etc.
If you use a space in an object, you must enclose it in [] brackets or quotes.
Special characters like % $ * & + # ! . ; ' " = ( ) [ ] { } / \ - and ^ mean something in VBA and should be avoided.
Avoid the underscore _ too. It is acceptable, but you must remember where it was used.

Use TitleCase. It is easier to read rptMonthlySalesSummary than RPTMONTHLYSALESSUMMARY.

Use prefixes so you can tell what type of object you are using. Otherwise tables and queries get confusing.

Object Prefix
Table tbl
Query qry
Form frm
Report rpt
Macro mcr
Module mod

Follow the same rules for fields within a table: FirstName, LastName, HomePhone, City, etc.

Each table must have a Primary Key to uniquely identify the record within the table. The primary key for tblCustomer should be CustomerID, for tblInvoice, InvoiceID, etc. The easiest data type for primary keys is the autonumber field. You don't have to enclose it in quotes and Access takes care of choosing the next value. If you need to choose a key that has meaning to users, use ItemNo to remind yourself that it isn't autonumber.

Foreign keys are a primary key in another table. For example, a customer can have many invoices. CustomerID is the primary key of tblCustomer, but a foreign key in tblInvoice. When you need info about the customer for an invoice, you can look it up in tblCustomer by its CustomerID.

Like Access objects, use prefixes for form and report objects if you refer to them.

Object Prefix
Label lbl
Textbox txt
Command Button cmd
Combo Box cbo
List Box lst
Line ln
Picture pic
Option Group opt
Checkbox chk
PageBreak pg
Subform sfrm
Object obj

There can be exceptions to your naming convention rules, but they should be for a really good reason.

Close