Introduction to Tables


Introduction to Data Fields


A Database From Scratch

In the previous lesson, we saw that you could create a database using one of the available templates. This approach provides you with readily made objects you can directly start using. Another technique consists of creating an empty database that has no built-in object. Starting a database from scratch allows you to create and add its different objects when necessary.

The main advantage of this approach is that you will exercise as much control as possible on your database because you will be creating all of your objects. The disadvantage is that you will miss that primary layout that the templates offer. Creating a database from scratch simply means starting from a blank database and adding the different components. Of course, after learning how to perform some changes, you will be able to modify some aspects of a database, whether created from a template or started from scratch.

To create a database from scratch, if you are just launching Microsoft Access, in the left section, you can click Featuring. Then, in the main section in the middle, click Blank Database, give a name in the File Name text box, and click Create.

Practical Learning: Creating a Blank Database

  1. Start Microsoft Access
  2. To start a new database, in the File section and under Available Templates, make sure Blank Database is selected or click it.
    In the right section, set the File Name to Clarksville Ice Cream
  3. Click Create to create the new database file

Introduction to Tables

Imagine you create a list of people. The list can be started with names as follows: Bill, James, Hermine, and Khan. This type of list is considered one-dimensional because all of its items fit in one category. In order to create a more detailed list, you may want to include these people's email addresses and probably other related information. If you include these additional pieces of information in the same category, the list may become confusing. To arrange the list, you would divide it in categories. Here is an example:

Name Email Address Phone Number Relationship
Bill bill@yahoo.com   Friend
James jamesemail.com (102)399-2893  
Hermine   (101) 447-8384 Cousin
Khan @Khan.com    

This type of display allows you to refer to a piece of information by its category. This is the basis of a table. A table is a two-dimensional list of items so that the items are arranged by categories. A complete or incomplete series of items that represent each category is called a record. Therefore, a table can be represented as follows:

In database development, a category is represented as a column. Sometimes it is also called a field. A record is represented as a row.

Database Object and Fields

A field is an object used to host, hold, or store a piece of information of a database. Before such an object can perform its function, it must first be created. In the strict sense, the most important or the most regularly used fields of a database are created on a table, but tables may not be the friendliest windows to present to a user for data entry. For this reason, fields can and should also be created on other windows.

The process of making a field available depends on the type of object it will reside on and probably how the field will be used. This leads to two categories of fields: those that can receive or store information and those that can only present or display it. All fields of a table, especially in Microsoft Access, are created to store data. On the other hand, fields on almost all of the other objects (queries, forms, reports) can be made of combinations of already existing fields of a table, or they can be created independently of any existing or non-existing data.

Table Layout


The Table's Tab

A table is presented as a rectangular window represented in the middle of the screen with a tab. As an option, you can remove the tabs and let the tables display without them. To do this, you can click File and click Options. In the left frame, click Current Database and, in the right frame, in the Document Window Options section, click the Tabbed Documents radio button and remove the check mark on the Display Document Tabs check box:

Access Options

After making the selection, you can click OK. You will be asked to close and reopen the database:

Message Box

Which you should do.

On the left side of its top section, a table presents an icon Table Icon. The table icon provides a menu you can access when you right-click. The menu allows you to save or change the view of the table.

When a table displays with a tab, the extreme right section of the tab(s) shows a close button Close you can click to close the table.

The Table System Buttons

In Microsoft Office Access 2010, by default, a table in Datasheet View is represented with a tab, which prevents the user from moving it around. If you want, you can make the tables of a database appear as single documents. To do this, open the Access Options dialog box from the File category. In the left frame, click Current Database. Under Document Window Options in the right frame, click the Overlapping Windows radio button:

Access Options

 When you click OK, you will be asked to close and reopen the database (which you should do).

A Table as a Datasheet

Although a table is primarily recognized as an arranged list of columns and rows, each column and each row intersect to create a rectangular box called a cell:

A Cell

The cell is actually the object that holds data of a table. A cell holds only one piece of information. The database developer decides what type of information would go into a cell but the user types that information. Based on its arrangement of cells, a table is said to display in a datasheet layout or simply a datasheet (because its view is made of cells).

The Scroll Bars

If you start entering data into a table and there are more records than the height of the table can display, the table would be equipped with a vertical scroll bar. The vertical scroll bar would allow you to move up and down on the datasheet. This is useful if/when a table has more records than can be displayed all at once, and this will happen regularly. In the same way, if a table contains one or more records than the width of the table can display, the table would be equipped with a horizontal scroll bar:

Scroll Bars

The presence or absence of one or both scroll bars is automatically managed by the operating system and you should not be concerned with the management of the scroll bars. At the same time, if your users need to use a table, they know how to use a scroll bar.

Table Navigation Buttons

The lower left side of the table is made of four buttons used to navigate the table, one button used to create a new record, and a text box. Each button plays a specific role:

Button Name Role
First Record Allows moving to the first record of the table
Previous Record Allows you to move one record back (if there is one) from the current record
Current Record Displays the number representing the current record out of the total number of records
Next Record Allows moving you one record ahead
Last Record Allows moving you to the last record of the table
 New (Blank) Record Used to enter a new record on the table

Introduction to Table Creation


Table Creation

To have a table as part of your database, you must create it. You have various options. If you create a database using one of the local templates, it would provide you with a few tables that you can start using. Otherwise, to create a table, on the Ribbon, you can click Create. In the Tables section, click Table. This would cause the Ribbon to switch to a section labeled Fields:

Tables Fields Templates

From the Fields tab, you can make selections.

Practical Learning: Creating a Table

  1. Open the Rockville Technologies database created in the previous lesson
  2. On the Ribbon, click Create
  3. In the Tables section, click Table

The Name of a Table

Like everything that is part of a database, a table must have a name that can be used to refer to that object throughout the database and in other files that can be linked to the table. There are two main ways you can specify the name of a table, either when you save it for the first time or if you decide to rename it.

To save a table you have just created:

If a table has not been saved before, you will be asked to provide a name for the table. A table can have almost any name: Employees, 2&&4DG, Pestes, verTT#@tg, etc. Because you and your users should be able to easily identify a table, there are suggestions you should follow when naming it:

In our lessons, we will not use the convention of prefixing the name of a database object with three letters. For example, the names of tables will not start with tbl. We came to this decision because most other database environments, including Microsoft SQL Server, do not suggest this rule. Although the lack of this rule may create some confusion, because you will end up having a table and a form with the same name, we will strive to explicitly state what object type we are referring to. For example, we will avoid writing, "Open Employees" or "Open the Employees object". Instead, we will usually state, "Open the Employees table".

Practical Learning: Saving a Table

  1. To save the table, right-click Table1 and click Save
  2. Type Corporate Items as the name of the table
    Save As
  3. Click OK
  4. To close the table, click its Close button Close

Table Management


The Tables in the Navigation Pane

Because the table is the primary object of a database, when you create a table and save it by giving it a name, Microsoft Access creates a section labeled Tables in the Navigation Pane and displays the name of thew new table in that section. In the same way, you can have as many tables as possible in the Tables section. Here is an example:


As we will see in the next lesson, you can create other object and they will have their sections. Each section is expandable and collapsible. To expand a section, click the header of that section. To the same to collapse a section.

Opening a Table

The most regular operations you will perform on a table require that you open it first. To open a table, first locate it in the Navigation Pane then:

Any of these actions causes the table to display in Datasheet View in the central area of the screen. In the same way, you can open as many tables as necessary.

Closing a Table

After using a table, you can close it. Before closing a table, first select its tab. Then, to close a table:

Selecting a Table

In order to use a table, some operations require that you (or rather the user) first select(s) it:

Renaming a Table

We saw that, when or after creating a table, you must save it to make it part of your database. When saving it for the first time, you must give it a name. If the name of a table is not appropriate, you can change it. To rename a table, in the Navigation Pane, you can right-click the name of the table and click Rename.

Practical Learning: Renaming a Table

  1. In the Navigation Pane window, right-click the Corporate Items table and click Rename
  2. Type Employees Resources as the new name of the table
  3. Press Enter

Deleting a Table

If you have a table you don't need anymore, you can remove it from your database. Because you cannot delete a table if it is opened, you must first close it.

To remove a table from your database:

In each case, you will receive a warning to confirm what you want to do. It is important to know that if you delete a table, because it is not a file, it does not go into the Recycle Bin: it is lost, including its records. Therefore, before deleting a table, make sure you really want to get rid of it. When in doubt, do not delete it.

Practical Learning: Deleting a Table

  1. In the Navigation Pane, right-click the Employees Resources table
  2. Click Delete
  3. Read the warning of the message box and click Yes

Tables Columns in the Datasheet View


Creating a Column

Although we did not mention it so far, a table does not exist without a column. Put it another way, a table must have at least one column in order to have meaning. This also means that, in order to create a table, it must actually have at least one column. If you start a table in Datasheet View, Microsoft Access creates and gives it one default column. Once a table displays in Datasheet View, you can start entering data into its cells. If you do this, whenever you enter data under a column, that column receives an incremental name: the first column on the right side of ID would be named Field1, the second would be Field2, and so on. These would be insignificant and can even be confusing. Fortunately, you can give meaningful names to the columns of your table.

Naming a Column

A column can have almost any name: "Book Title", "DG$5@H", "This Is The Book Title", "R8%%DW$4", etc. Some columns will have only tinny data, like a person's age, the number of books in an office, a person's middle initial, etc. It may not be a good idea to give them a name that would take too much space.

To name a field, first figure out what the data in the category will be made of. If you are planning to enter employees' salaries in a field, you can just call it Salary. If you want to specify employees's names by first name, middle name, and last name, you can use such column names and make them distinct. In this case, you could name the first column as first name, the last name would be called last name. Although you can use one word names, some people might be confused. The suggestion is to distinguish wherever a new English (or the language you are using to design your database) name starts in the field name, by using a starting uppercase. Instead of firstname or first name, you can use FirstName or First Name. Instead of fullname or full name, you can use FullName or Full Name.

Before changing the name of a column:

Any of these actions would put the name of the column into edit mode. You can then type the new desired name or change the existing name.

Using a Sample Field

When you start a table in the Datasheet View, the Ribbon becomes equipped with a new tab labeled Fields. The sample fields and their configurations are distributed in various sections. One of the sections of the Fields tab is named Add & Delete:

Add and Delete

Microsoft Access provides many pre-configured fields you can add to your table. These ready-made sample columns are referred to as a Field Templates. To use a field template, while the table is displaying in Datasheet View:

Field Templates



Practical Learning: Using Fields

  1. Click File
  2. In the list of previously opened databases, click Clarksville Ice Cream
  3. To create a new table, on the Ribbon, click Create
  4. In the Tables section, click Table
  5. Click Click To Add and click Text
  6. When it is highlighted, type Order Date and press Enter
    Table in Datasheet View
  7. As the menu displays in the next column, click Text
  8. Type Order Time and press Enter
  9. As the menu appears in the next column header, click Text
  10. Type Container and press Tab
  11. Press Esc
    Table Creation: New Field
  12. Close the table
  13. When asked whether you want to save it, click Yes
  14. Type Customers Orders as the name of the table
  15. Click OK
  16. To start a new table, on the Ribbon, click Create
  17. Click Table
  18. In the Add & Delete section, click Text Text
  19. Type Manufacturer and press Enter
  20. Press Esc
  21. In the Add & Delete section, click Text Text
  22. Type Model and press Enter
  23. Press Esc
  24. In the Add & Delete section, click Date & Time Date And Time
  25. Type Acquired Date and press Enter
  26. Press Esc
  27. In the Add & Delete section, click Currency Currency
  28. Type Purchase Price and press Enter
  29. Press Esc
  30. In the Add & Delete section, click Text Text
  31. Type Company and press Enter
  32. Press Esc
  33. Right-click Table1 and click Save
  34. Set the name to Company Assets
  35. Click OK
  36. Click its Close button Close

Columns Maintenance in the Datasheet View


Importing a Table and its Columns

Although a column completely depends on a table, both objects are closely related when it comes to their maintenance. In other words, the maintenance performed on one object can directly affect the other. For example, you can import a table from a text file or from another application. A table cannot exist without at least one column.

Selecting a Column

Some operations will require that you select a column but it depends on the operation you want to perform. In some cases, when any cell under a column has focus (for example if the caret is blinking in a cell of a column), the column is considered to be selected. Otherwise:

Changing the Width of a Column

If you create a table using one of the Table Templates or if you get a table from a Database Template, the columns of the tables are wide enough to show their names. If  you create a table from scratch in the Datasheet View, Microsoft Access assigns it a default width. That width can appear to be too narrow or too wide. For example, when data exceeds the regular width of a column, part of the information would be hidden. If a particular column contains data that you want to display at all times, you can enlarge the column. On the other hand, if a column displays tinny pieces of information, you can narrow the column to let it just fit the data as desired. There are various techniques you can follow to widen or narrow a column.

To change the width of a column:

Moving a Column

If you find out that a particular column is misplaced in a table, you can change its position.

To move a column in Datasheet View, first select it. Click and hold your mouse on it. Then, start dragging left or right in the desired direction. While your mouse is moving, a thick vertical line will guide you. Once the vertical line is positioned to the desired location, release the mouse:

To move a group of columns, first select them as we reviewed earlier. Click and hold the mouse on one of the selected columns. Start dragging left or right in the desired direction until the thick vertical guiding line is positioned in the desired location, then release the mouse:

Inserting a Column

Inserting a column consists of adding one between two existing fields. To do this, right-click the column that will succeed it and click Insert Field

Practical Learning: Inserting a Column

  1. The Clarksville Ice Cream database should still be opened.
    In the Navigation Pane, double-click the Customers Orders to open the table
  2. To add a new field, right-click the Order Date column header and click Insert Field
  3. Click the cell under Order Time
  4. In the Add & Delete section of the Ribbon, click Text

Renaming a Column

To rename a column, you must put it into edit mode. To do this:

Once the name is in edit mode, type the desired name and press Enter.

Practical Learning: Renaming a Column

  1. The Clarksville Ice Cream database should still be opened.
    Right-click the Field1 column header and click Rename Field
  2. Type Clerk and press Enter
  3. Right-click Field2 and click Rename Field
  4. Type Flavor and press Enter
  5. Close the table

Hiding and Revealing a Hidden Column

If a table contains many columns and at one time you think you don't need all of them, you can hide some. To hide a column, you can drag the right border of its column header completely to its left border as we saw earlier to change the width of a column; when the vertical guiding line reaches the left border, release the mouse: the column would be hidden from the table:


To hide one or a group of columns, you can right-click and click Hide Fields. You can also right-click any column and click Unhide Fields. This would open the Unhide Columns dialog box. Here is an example:

Unhide Columns

To hide a column, clear its check box.

To reveal a column or a group of columns previously hidden, right-click any column header on the table and click Unhide Column. In the Unhide Columns dialog box, put a check mark on each column you want to show.

Deleting a Column

If you have an undesirable column in a table, you can delete it. It is important to keep in mind that if you delete a column, it also goes with any information under it.

To remove a column from a table:

Any of these actions would present you a warning to confirm whether you still want to delete the column(s) or you want to change your mind. If you still want to remove the column(s), click Yes.

Lesson Summary




Yugo National Bank

  1. Create a blank database and name it Yugo National Bank1
  2. Double-click Add New Field and type AccountType
  3. Add one more column named  Description 
  4. Change ID to AccountTypeID
  5. Save the table as AccountTypes

Watts A loan

  1. Create a blank database and name it Watts A Loan1
  2. After the default ID column, create the following additional columns: FirstName, MiddleName, LastName, Address, City, State, ZIPCode, Country, HomePhone, WorkPhone, EmailAddress, and Notes
  3. Rename the ID column as CustomerID
  4. Save the table as Customers

Previous Copyright © 2000-2016, FunctionX Next