Naming Conventions for Microsoft Access

Software development in Microsoft Access istypes that make up Microsoft Access, each of the
relatively simple and almost anyone can do it but if youobjects has its own prefixes. A list of those prefix
want to be taken seriously by professional databasenames you should be using for the Access Object
developers then there are some mandatory rules thatTypes are shown below -db - Databasetbl -
you must follow whilst developing your database. OneTablesqry - Queriesfrm - Formsrpt - Reportsmcr -
of the first aspects professional developers will look atMacrosmdl - Modules
when reviewing your work will be the namingOne of the key reasons we name our tables and
standards you are using for your Microsoft Accessqueries with a prefix is that when you are working
Objects. Microsoft Access allows you to use, what iswith these two object types in the query window,
considered in the professional database developmentMicrosoft Access simply lists all tables and queries
world, poor naming standards. For example in your fieldtogether without differentiating them. By using the tbl
names, you can have spaces however in theand qry prefixes on these two objects, it always
professional world that is a major no no.ensures that the tables are shown first and then the
One of the reasons we don't use spaces in Microsoftqueries because t comes before q.
Access is that when you start creating complexOther objects that need to be named include the
queries and functions that refer to fields, if you havebound and unbound controls found on forms and
spaces in the field names it is possible to put tworeports. When you create a form or report using the
spaces into the field name but it only appears thatwizard or AutoForm or AutoReport each of the
there one space. What this means is that your querycontrols are named the same as the field names. Now
won't work and can sometimes take many days towhilst this is by default, it is not really an acceptable
find the mistake. The key issue is that you must neverway of naming controls. One of the key reasons we
use spaces in your field names, database names ordon't want to do this is that sometimes when we are
any of the seven different object types. There are inworking with forms and reports we want to refer to
fact two ways that you should be naming your fields,the control rather than the field. By having the field
database names and so on.names the same as the object names, you can often
Naming Fieldshave a situation where the wrong control is referred
Let us say for instance you wanted to create a fieldto. The way we overcome this, is by naming our
to store the Postcodes for the suburbs yourcontrols based on the control type. For example if our
customers live in. We could write this field in two ways,field was called fldPostcode and the control we are
the first thing you must do for fields is to add the prefixusing for this field is a text box, then we would name
fld at the start of the field. Then add the field name asthe text box txtPostcode. Below is a list of prefixes
required -fldPostcode or fldPost_codefor the forms and report objects.frm - Formsrpt -
Either technique is quite acceptable. If you wereReportslbl - Lablestxt - text boxescmd - command
developing a field for Post Codes, that is codes onbuttonslst - List Boxescmb - combo boxesopt - option
posts, then the recommended way for writing the fieldbuttonsole - ole objectschd - Child Objects (Subforms
name would be -fldPostCode or fldPost_Codeor subreports)
You will notice that in the second example the secondFor a full list of all prefix names that you should be
word is in capitals rather than in lower case. The useusing in Microsoft Access Development is shown
of capital letters signifies that each word represents abelow:
separate aspect of the field, so in this case the code inMicrosoft Access Objectsdb - Databasetbl -
capitals means you are referring to codes on posts.Tablesqry - Queriesfrm - Formsrpt - Reportsmcr -
The same naming principles apply to database names,Macrosmdl - Modules
and each of the seven Microsoft Access objectTable Objects -tbl - Core Data Storetmp - For
types.temporary Tablesbck - Tables that you have backed
Naming Tablesup
When naming tables, there are three prefixes that youForms & Reports Objects -frm - Formsrpt -
can use. The first prefix tbl is used for the core tablesReportslbl - Lablestxt - text boxescmd - command
you will be storing your good data in. The tmp prefix isbuttonslst - List Boxescmb - combo boxesopt - option
used for tables that will be storing temporary data. It isbuttonsole - ole objectschd - Child Objects (Subforms
also recommended that you import your data into aor subreports)
temporary table before inserting the data into yourReport Names -rpt - For General Reportscht - For
good data tables. We do this for two core reasons;Chart Reportslbl - For Label Reports
the first is that testing your data in a temporary table isVariables -str - stringsole - ole object typesint -
much easier than doing it on the fly while you are tryingintegersdec - decimaldte - dates
to import your data.Module Objects -sub - Subroutinesfn - Private
The third table prefix I recommend being used is bckFunctionspfn - Public Functions
for backup tables. The key advantage of using theseUsing the naming standards shown above will assure
prefix's on your tables is that Microsoft Access willthat if you do require assistance from a professional
automatically group them by the prefix, which meansdatabase developer that they will take you far more
you will keep all your good tables together, yourseriously than before because you have shown a
temporary tables together and your backup tablesprofessional understanding on how to name your
together.database object. This will certainly give you credibility in
Naming the Seven Access Object Typesthe eyes of professional database developers.
When you are working with the seven different object