|
Introduction to Microsoft Access 2003
Creating a Table Every database you create must contain at least one table, and this database is no exception. Let's start things off by creating a table to track information about Splat's customers. You work a little backwards to create a table. First, you have to define the fields. Then, you add records. Once you have at least one record under your belt, you have a full-fledged table (although not a very big one)! Let's give it a try. Click the Tables tab on the left side of the Database window. Next, click the New button on the top of the Database window. The New Table dialog box will appear. ![]() This dialog box allows you to add a table to your database using a variety of techniques. We'll explore most of these techniques as we work our way through class. For now, let's go with the Design View technique. Please click Design View in the new table dialog box and then click the OK button at the bottom of the dialog box. A Table Design dialog box will soon appear. ![]() The Table Design dialog box is divided into four sections:
Creating Fields Remember, we want to build a table we can use to keep tabs on Splat's customers. This table will consist of a number of records--one record for each customer. If Splat has 25 customers, our table will need to have 25 records. If Splat has 2500 customers, then our table will need to have 2500 records. The number of records will rise and fall as Splat acquires and loses customers. Each customer record will, in turn, be made up of several unique fields. Each field will hold one and only one specific piece of information about the customer. Our job now is to define what types of customer information we're going to store in each field. If you were in charge of monitoring Splat's customers, what kind of information would you want to track? There's the customer's name, of course. Since Splat is a wholesaler that sells directly to retail stores, we will also need the name of a contact person at each outlet. And we'd definitely want that person's phone number, in case we ever have to call. The store address would be useful, as well. I'm sure there are plenty of other informational tidbits we should collect. But we've got enough to give it a running start. Click your mouse on the first row of the Field Name column. Let's start things off by creating a field to hold our customers' names. Type CustomerName in the Field Name column. Tip: Although Access will allow you to use spaces in your field names, some database programs, spreadsheets, and word processors do not. If you think it's possible that someone might want to export this table to another application some day, try to avoid using spaces in your field names. When you finish typing a name for the field, press the TAB key on your keyboard to move into the first row of the Data Type column. You'll use the Data Type column to tell Access what type of information you're most likely going to be storing in this field. Telling Access this in advance will help it allocate an adequate amount of storage space for the information. It will also allow Access to keep an eye out for data entry errors when you start filling the table. The customer's name will most likely consist of text, so click the down arrow on the right side of this column and choose Text from the list that drops down. You can also type the word Text, if you prefer. Tab into the Description column on the first row. Now, glance at the Field Properties section at the bottom of the dialog box. Click the General tab, if necessary. Notice how Access has set the field size to 50 (characters). That seems a bit excessive for a customer name. I can't imagine Splat having any customer with a name longer than 30 characters. Let's reduce the field size to 30 characters. To do so, click in the Field Size text box. Backspace or delete the number 50 and type 30 instead. Tip: If you prefer to navigate with your keyboard instead of your mouse, you can jump into and out of the Field Properties section of this dialog box by tapping your F6 key repeatedly. And don't forget that you can move from field to field with your TAB key. You can also move backwards from one field to another by holding down the SHIFT key and tapping TAB repeatedly. Give these keyboard shortcuts a try! Now, please return to the first row of the Description column. Write the following description for your CustomerName field:
![]() That's it for our first field. Let's add another! Click the second row of the Field Name column. Type Contact and press TAB. Change the data type to Text. Press TAB again to move into the Description column on the second row. Let's try to explain the purpose of this field. Type the following description of the purpose of this field in the Description column:
Before you leave the second row, change the content of the Field Size text box in the Field Properties section to 30. Again, I can't see a name being any longer than that. The less space you ask Access to allocate for each field, the smaller, faster, and more efficient your database will be. Click the third row of the Field Name column. Fill in this and all subsequent rows as described below. Remember that you can jump back and forth between the Field Name and Field Properties sections by tapping the F6 key.
You'll notice that I left some of the Descriptions blank. Unlike the field name and the data type, the Description is optional. You don't have to type one if the purpose of the field is self-evident. You may also have noticed that we created a Memo field at the very end. Memo fields are just like text fields, but with two important differences:
Tip: If you missed a row, just click where you'd like the row to appear. Then click the Insert menu at the very top of your screen and choose Rows.
|
resources | lessons | quizzes | assignments | discussion | completion
|
Course content © Education To Go. All rights reserved. Reproduction or redistribution of any course material without prior written permission is prohibited. |