| Software development in Microsoft Access is | | | | way we overcome this, is by naming our |
| relatively simple and almost anyone can do it | | | | controls based on the control type. For |
| but if you want to be taken seriously by | | | | example if our field was called fldPostcode |
| professional database developers then there | | | | and the control we are using for this field |
| are some mandatory rules that you must follow | | | | is a text box, then we would name the text |
| whilst developing your database. One of the | | | | box txtPostcode. Below is a list of prefixes |
| first aspects professional developers will | | | | for the forms and report objects.frm - Forms |
| look at when reviewing your work will be the | | | | |
| naming standards you are using for your | | | | rpt - Reports |
| Microsoft Access Objects. Microsoft Access | | | | |
| allows you to use, what is considered in the | | | | lbl - Lables |
| professional database development world, poor | | | | |
| naming standards. For example in your field | | | | txt - text boxes |
| names, you can have spaces however in the | | | | |
| professional world that is a major no no.One | | | | cmd - command buttons |
| of the reasons we don't use spaces in | | | | |
| Microsoft Access is that when you start | | | | lst - List Boxes |
| creating complex queries and functions that | | | | |
| refer to fields, if you have spaces in the | | | | cmb - combo boxes |
| field names it is possible to put two spaces | | | | |
| into the field name but it only appears that | | | | opt - option buttons |
| there one space. What this means is that | | | | |
| your query won't work and can sometimes take | | | | ole - ole objects |
| many days to find the mistake. The key issue | | | | |
| is that you must never use spaces in your | | | | chd - Child Objects (Subforms or |
| field names, database names or any of the | | | | subreports)For a full list of all prefix |
| seven different object types. There are in | | | | names that you should be using in Microsoft |
| fact two ways that you should be naming your | | | | Access Development is shown below:Microsoft |
| fields, database names and so on.Naming | | | | Access Objectsdb - Database |
| FieldsLet us say for instance you wanted to | | | | |
| create a field to store the Postcodes for the | | | | tbl - Tables |
| suburbs your customers live in. We could | | | | |
| write this field in two ways, the first thing | | | | qry - Queries |
| you must do for fields is to add the prefix | | | | |
| fld at the start of the field. Then add the | | | | frm - Forms |
| field name as required -fldPostcode or | | | | |
| fldPost_codeEither technique is quite | | | | rpt - Reports |
| acceptable. If you were developing a field | | | | |
| for Post Codes, that is codes on posts, then | | | | mcr - Macros |
| the recommended way for writing the field | | | | |
| name would be -fldPostCode or fldPost_CodeYou | | | | mdl - ModulesTable Objects -tbl - Core Data |
| will notice that in the second example the | | | | Store |
| second word is in capitals rather than in | | | | |
| lower case. The use of capital letters | | | | tmp - For temporary Tables |
| signifies that each word represents a | | | | |
| separate aspect of the field, so in this case | | | | bck - Tables that you have backed upForms & |
| the code in capitals means you are referring | | | | Reports Objects -frm - Forms |
| to codes on posts. The same naming | | | | |
| principles apply to database names, and each | | | | rpt - Reports |
| of the seven Microsoft Access object | | | | |
| types.Naming TablesWhen naming tables, there | | | | lbl - Lables |
| are three prefixes that you can use. The | | | | |
| first prefix tbl is used for the core tables | | | | txt - text boxes |
| you will be storing your good data in. The | | | | |
| tmp prefix is used for tables that will be | | | | cmd - command buttons |
| storing temporary data. It is also | | | | |
| recommended that you import your data into a | | | | lst - List Boxes |
| temporary table before inserting the data | | | | |
| into your good data tables. We do this for | | | | cmb - combo boxes |
| two core reasons; the first is that testing | | | | |
| your data in a temporary table is much easier | | | | opt - option buttons |
| than doing it on the fly while you are trying | | | | |
| to import your data.The third table prefix I | | | | ole - ole objects |
| recommend being used is bck for backup | | | | |
| tables. The key advantage of using these | | | | chd - Child Objects (Subforms or |
| prefix's on your tables is that Microsoft | | | | subreports)Report Names -rpt - For General |
| Access will automatically group them by the | | | | Reports |
| prefix, which means you will keep all your | | | | |
| good tables together, your temporary tables | | | | cht - For Chart Reports |
| together and your backup tables | | | | |
| together.Naming the Seven Access Object | | | | lbl - For Label ReportsVariables -str - |
| TypesWhen you are working with the seven | | | | strings |
| different object types that make up Microsoft | | | | |
| Access, each of the objects has its own | | | | ole - ole object types |
| prefixes. A list of those prefix names you | | | | |
| should be using for the Access Object Types | | | | int - integers |
| are shown below -db - Databasetbl - Tablesqry | | | | |
| - Queriesfrm - Formsrpt - Reportsmcr - | | | | dec - decimal |
| Macrosmdl - ModulesOne of the key reasons we | | | | |
| name our tables and queries with a prefix is | | | | dte - datesModule Objects -sub - Subroutines |
| that when you are working with these two | | | | |
| object types in the query window, Microsoft | | | | fn - Private Functions |
| Access simply lists all tables and queries | | | | |
| together without differentiating them. By | | | | pfn - Public FunctionsUsing the naming |
| using the tbl and qry prefixes on these two | | | | standards shown above will assure that if you |
| objects, it always ensures that the tables | | | | do require assistance from a professional |
| are shown first and then the queries because | | | | database developer that they will take you |
| t comes before q.Other objects that need to | | | | far more seriously than before because you |
| be named include the bound and unbound | | | | have shown a professional understanding on |
| controls found on forms and reports. When | | | | how to name your database object. This will |
| you create a form or report using the wizard | | | | certainly give you credibility in the eyes of |
| or AutoForm or AutoReport each of the | | | | professional database developers.Chris Le Roy |
| controls are named the same as the field | | | | is a professional software developer and has |
| names. Now whilst this is by default, it is | | | | been developing software applications for |
| not really an acceptable way of naming | | | | over 20 years in Visual Basic, VB .net, VBA, |
| controls. One of the key reasons we don't | | | | C++, Microsoft SQL Server, Transact SQL, ASP, |
| want to do this is that sometimes when we are | | | | PHP and Microsoft Access. He is the Managing |
| working with forms and reports we want to | | | | Director of One-on-One Personal Computer |
| refer to the control rather than the field. | | | | Training that trains over 2000 people per |
| By having the field names the same as the | | | | year across Australia and Overseas from basic |
| object names, you can often have a situation | | | | Microsoft Office functionality to advanced |
| where the wrong control is referred to. The | | | | Database Design and VBA. |