Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Lesson Four Setting Up Tables And Fields


Published on

  • Be the first to comment

Lesson Four Setting Up Tables And Fields

  1. 1. Setting Up Tables and Fields<br />Lesson Four ( ACCESS 2007)<br />
  2. 2. 
Now that we have a handle on what the database should look like, we need to work on setting up our tables and the fields within those tables. 

This lesson will walk you through the steps of setting up a database in Access 2007. You will be setting up tables according to the plan for our bookstore scenario. You will also be setting up the fields for each table, including establishing what data types can be entered in a given field.<br />
  3. 3. Creating a New Database with Access<br />When you launch Access 2007, you will see the Getting Started window.<br />In the left pane, the template categories including the featured local templates are listed, as well as the categories on Office Online. Templates are pre-built databases focused on a specific task that you can download and use immediately.<br />You will also see the New Blank Database option that allows you to build your own database from scratch.<br />
  4. 4. When you choose the New Blank Database option at the top of this window, you will be prompted to rename the database from the default name, which is Database1.accdb. Rename the database whatever you would like the name to be. In the example below, we named the database Ready2Read since that is the name of the store in our scenario.<br />Click Create to finish naming the database.<br />
  5. 5. Setting up Tables<br />The new database opens with one table showing as a default. It also defaults to naming this table Table1 in both the Navigation Pane, and the Table tab itself. You will want to name your tables based on your database design plan.<br />
  6. 6. Naming a Table<br />To give the table a unique name, you must first click on the Microsoft Office Button in the upper left hand corner of the application.<br />
  7. 7. Then, select Save from the menu. The Save As dialog box will appear to let you save the table as whatever name you choose.<br />
  8. 8. The new table names appear in both the Navigation Pane and the Table tab itself, as you can see in the picture below.<br />
  9. 9. To Rename a Table<br />With the table closed, right click on the Table you wish to rename in the Navigation Pane. Select the Rename option that appears in the menu. <br />The table name will be highlighted and a cursor will appear, which means you can now type in the new name right there. Left click anywhere outside of the Table name to make the change.<br />
  10. 10. To Close a Table<br />There are several ways to close an active table. You can right click on the Table tab and choose Close from the menu.<br />
  11. 11. A more common method is to click the X that appears in the upper right hand corner of the active database object window.<br />
  12. 12. To Open a Table<br />To open a table, right click the Table name of the table you wish to open in the Navigation Pane. Then, choose Open from the menu.<br />A more common method is to double click the table name in the Navigation Pane. The selected table will open in the active database object window.<br />
  13. 13. Adding More Tables to the Database<br />By default, Access 2007 starts out with one table. To add more tables to the database, click on the Create tab on the Ribbon.<br />Then, select Table from the Tables command group. A new table will open in the active database object window. You must name your table using the Save command from Microsoft Office menu. Naming a Table was addressed on page 3 of this lesson.<br /><ul><li>TIP: You can tell which table you are currently in by seeing which table tab is highlighted.</li></li></ul><li>Adding Fields to a Table<br />Access 2007 allows you to add fields to tables when you are:<br />working in Datasheet View, which looks like a spreadsheet<br />working in Design View, where you are able to set more controls for your fields.<br />Either way, you need to know how to switch between the two views.<br />
  14. 14. Switching Views<br />To switch views, select the Views command group from either the Home tab (seen below) or the Datasheet tab on the Ribbon. Select the view option you would like from the menu. <br />
  15. 15. Adding Fields in Datasheet View<br />By default, Access 2007 creates one field in each new table, the ID field. This field auto-numbers to give each record in the table a unique number identifier. Recall that records are the rows in a table.<br /><ul><li>TIP: You may want to rename the ID field with a unique name, since the ID field appears automatically in every table you create. While this is not necessary, it may help avoid confusion when setting up table relationships.</li></li></ul><li>To add more fields to a table in Datasheet View, double click on the Add New Field header.<br />The Add New Field text will disappear from the header. Name the field by typing the name directly into the header. Press the tab key on your keyboard to move to the next field.<br />
  16. 16. Adding Fields in Design View<br />In Design View, the field names are along the left-hand column instead of across the top like in Datasheet View, as seen below.<br />
  17. 17. To add a new field to a table in Design View, just click in the cell where you want the new field and type the field name. When you switch back to Datasheet View, your new field appears as its own column, as seen below.<br />
  18. 18. Moving Fields<br />If you want to rearrange the order in which your fields appear in a table, Access 2007 lets you easily move them around. To move a field in Datasheet View, drag and drop the field to the location you want. To do this:<br />Click on the field header for the field you wish to move.<br />Move the mouse in the area of the header.<br />When the cross with arrows appears, hold down your left mouse button.<br />With the left mouse button still held down, move the cursor to where you would like the field to appear.<br />Release the mouse button and the field appears in its new location.<br />
  19. 19. Deleting Fields<br />To delete a field in Datasheet View, just click on the field header and then select Delete from the Field &Column command group. This is found on the Datasheet tab on the Ribbon.<br /><ul><li>WARNING: You should not delete any field in a table without first knowing what impact the deletion may have on the rest of the database!</li></li></ul><li>Setting the Data Type for a Field<br />Access 2007 lets you control how data can be entered in each table field within your database. This is done using Data Type. The default Data Type is text for every field after the ID field, which was set to auto number. You can change the Data Type setting:<br />from the Data Type & Formatting command group on the Ribbon<br />from the Data Type column in Design View<br />
  20. 20. From the Ribbon<br />To change the data type from the Ribbon, click on the field header. Then, select the data type you want from the drop down menu next to the Date Type command.<br />
  21. 21. In Design View<br />To change the data type in Design View, click the field name and then press the tab key on your keyboard. From the drop down menu under the Data Type column, select the format you want.<br />The Data Type is more noticeable when the database is being populated with records. It will cause data to be formatted for currency, text, number, and date/time just in Microsoft Excel.<br />
  22. 22. Challenge<br />Open Access 2007 and build your own database:<br />Give Table1 a new name<br />Add a new table<br />Add fields to a table<br />Set the data type for a field in a table<br />Open and close the tables<br />Move a field in a table<br />Delete a field in a table<br />