Naming Conventions for Microsoft Access

Software development in Microsoft Access iscomes before q.Other objects that need to be
relatively simple and almost anyone can do it but ifnamed include the bound and unbound controls found
you want to be taken seriously by professionalon forms and reports. When you create a form or
database developers then there are some mandatoryreport using the wizard or AutoForm or AutoReport
rules that you must follow whilst developing youreach of the controls are named the same as the field
database. One of the first aspects professionalnames. Now whilst this is by default, it is not really an
developers will look at when reviewing your work willacceptable way of naming controls. One of the key
be the naming standards you are using for yourreasons we don't want to do this is that sometimes
Microsoft Access Objects. Microsoft Access allowswhen we are working with forms and reports we
you to use, what is considered in the professionalwant to refer to the control rather than the field. By
database development world, poor naming standards.having the field names the same as the object
For example in your field names, you can havenames, you can often have a situation where the
spaces however in the professional world that is awrong control is referred to. The way we overcome
major no no.One of the reasons we don't use spacesthis, is by naming our controls based on the control
in Microsoft Access is that when you start creatingtype. For example if our field was called fldPostcode
complex queries and functions that refer to fields, ifand the control we are using for this field is a text
you have spaces in the field names it is possible tobox, then we would name the text box txtPostcode.
put two spaces into the field name but it onlyBelow is a list of prefixes for the forms and report
appears that there one space. What this means isobjects.frm - Forms
that your query won't work and can sometimes takerpt - Reports
many days to find the mistake. The key issue is thatlbl - Lables
you must never use spaces in your field names,txt - text boxes
database names or any of the seven differentcmd - command buttons
object types. There are in fact two ways that youlst - List Boxes
should be naming your fields, database names and socmb - combo boxes
on.Naming FieldsLet us say for instance you wantedopt - option buttons
to create a field to store the Postcodes for theole - ole objects
suburbs your customers live in. We could write thischd - Child Objects (Subforms or subreports)For a
field in two ways, the first thing you must do forfull list of all prefix names that you should be using in
fields is to add the prefix fld at the start of the field.Microsoft Access Development is shown
Then add the field name as required -fldPostcode orbelow:Microsoft Access Objectsdb - Database
fldPost_codeEither technique is quite acceptable. Iftbl - Tables
you were developing a field for Post Codes, that isqry - Queries
codes on posts, then the recommended way forfrm - Forms
writing the field name would be -fldPostCode orrpt - Reports
fldPost_CodeYou will notice that in the secondmcr - Macros
example the second word is in capitals rather than inmdl - ModulesTable Objects -tbl - Core Data Store
lower case. The use of capital letters signifies thattmp - For temporary Tables
each word represents a separate aspect of the field,bck - Tables that you have backed upForms &
so in this case the code in capitals means you areReports Objects -frm - Forms
referring to codes on posts. The same namingrpt - Reports
principles apply to database names, and each of thelbl - Lables
seven Microsoft Access object types.Namingtxt - text boxes
TablesWhen naming tables, there are three prefixescmd - command buttons
that you can use. The first prefix tbl is used for thelst - List Boxes
core tables you will be storing your good data in. Thecmb - combo boxes
tmp prefix is used for tables that will be storingopt - option buttons
temporary data. It is also recommended that youole - ole objects
import your data into a temporary table beforechd - Child Objects (Subforms or subreports)Report
inserting the data into your good data tables. We doNames -rpt - For General Reports
this for two core reasons; the first is that testingcht - For Chart Reports
your data in a temporary table is much easier thanlbl - For Label ReportsVariables -str - strings
doing it on the fly while you are trying to import yourole - ole object types
data.The third table prefix I recommend being used isint - integers
bck for backup tables. The key advantage of usingdec - decimal
these prefix's on your tables is that Microsoft Accessdte - datesModule Objects -sub - Subroutines
will automatically group them by the prefix, whichfn - Private Functions
means you will keep all your good tables together,pfn - Public FunctionsUsing the naming standards
your temporary tables together and your backupshown above will assure that if you do require
tables together.Naming the Seven Access Objectassistance from a professional database developer
TypesWhen you are working with the seventhat they will take you far more seriously than
different object types that make up Microsoftbefore because you have shown a professional
Access, each of the objects has its own prefixes. Aunderstanding on how to name your database object.
list of those prefix names you should be using forThis will certainly give you credibility in the eyes of
the Access Object Types are shown below -db -professional database developers.Chris Le Roy is a
Databasetbl - Tablesqry - Queriesfrm - Formsrpt -professional software developer and has been
Reportsmcr - Macrosmdl - ModulesOne of the keydeveloping software applications for over 20 years in
reasons we name our tables and queries with aVisual Basic, VB .net, VBA, C++, Microsoft SQL
prefix is that when you are working with these twoServer, Transact SQL, ASP, PHP and Microsoft
object types in the query window, Microsoft AccessAccess. He is the Managing Director of One-on-One
simply lists all tables and queries together withoutPersonal Computer Training that trains over 2000
differentiating them. By using the tbl and qry prefixespeople per year across Australia and Overseas from
on these two objects, it always ensures that thebasic Microsoft Office functionality to advanced
tables are shown first and then the queries because tDatabase Design and VBA.