Creating Tables in Design View
This section describes how to create Access tables.
- By clicking the Table tab on the left hand side, you will find Access provides three ways to create a table for which there are icons in the database window.
- Create Table in Design view will allow you to create the fields of the table. It allows you to define the fields in the table before adding any data to the datasheet. This is the most common way of creating a table and is explained in detail below.
- Create table by using wizard will walk you through the creation of a table.
- Create table by entering data will give you a blank datasheet with unlabelled columns that looks much like an Excel worksheet.
- Double-clicking on Create table in Design view displays the Table Design screen where you define fields for your table. The screen is divided into two parts: a top pane for entering the field name, data type, and an option description of the field, and a bottom pane for specifying field properties.
- Every table consists of fields. For each field, specify the name of the field, the type of data, and any description needed to determine what data the field contains. Pressing the Tab key moves the cursor from one column to the next in the Table Design screen. You can select the data type from the drop-down list in the Data Type column as shown in Figure 6.
- Each table in your database should have a “primary key.” A primary key is a field that uniquely identifies each record in the database. In a database of book collection, there might be two books with the same author so author is not a good primary key. However, every book has a unique “call number”, so “call number” would be a good choice for a primary key. To set the primary key for your table, hightlight the key field and choose Primary Key from the Edit menu.
- When the primary key is set, you should find a little key icon next to the field name on the left side. Note: To remove a primary key, simply repeat this procedure to toggle the primary key off.
- As a final step, the table must be saved. Pull down the File Menu to choose Save. A dialogue box will pop up where the name of the new table should be specified. Access gives a default name such as “Table1” or “Table2.” Simply type over this default name with the name of the table. For this example, name the table “Book_Info”, then click OK.
- At this point, the new table has been created and saved. Switch back to the Access main screen by pulling down the File menu and choosing Close. This will close the Design View for the table and display the Access main screen. Notice that the new Book_Info table appears below the Table tab.