totn Access

MS Access: Setting up Tables and Naming Fields (Programming Standards)

Here are a few of the programming standards that we try to follow when setting up tables and defining fields within those tables.

Setting up Tables

Guideline #1: Create tables with meaningful names. For example, if you want to create a table that stored information about your suppliers, then name the table Suppliers.

Microsoft Access

Guideline #2: Even though Access allows spaces in your table names, you may want to consider using the underscore character ("_") instead of a space. This will make it easier for you in the long run if you decide to port your tables to a different database. Most other databases do not allow spaces in table names.

For example, if you wanted to create a table that stored your order details, instead of calling the table Order Details, you might want to consider naming the table Order_Details.

Microsoft Access

Guideline #3: Use only alphanumeric characters when naming your tables. Do not use characters such as colons, semi-colons, brackets, etc.

Guideline #4: Try to create a primary key on your tables. A primary key is what uniquely defines each record in a table. If you do not have a combination of fields in your table that uniquely defines a record, then consider creating an AutoNumber field that acts as your primary key.

In the example below, we've created an AutoNumber field called Supplier_ID that acts as a primary key in our Suppliers table.

Microsoft Access

Naming Fields

The programming standards that we use for naming fields are very similar to those for naming tables.

Guideline #1: Create field names that are meaningful. Do not name your field names - Field1, Field2, Field3, etc., but choose names that identify what kind of information will be stored in the fields.

Guideline #2: Even though Access allows spaces in your field names, you may want to consider using the underscore character ("_") instead of a space. This will make it easier for you in the long run if you decide to port your tables to a different database. Most other databases do not allow spaces in field names.

For example, if you wanted to set up a field that stored the company name, instead of calling the field Company Name, you might want to consider naming the field Company_Name.

Microsoft Access

Guideline #3: Use only alphanumeric characters when naming your fields. Do not use characters such as colons, sem-colons, brackets, etc.