Share this Page URL

Chapter 1. The HelloWorld Database > Creating a Table - Pg. 5

The HelloWorld Database 5 Defining a Table's Fields Remember, fields identify the data that a table holds--for example, First Name, Last Name, Street Address, and City in a table of names and addresses, or Item Number, Color, Size, Quantity, and Price in a table of product orders. When naming fields, you should strive to follow a naming and spelling convention. The preceding examples of field names are all capitalized. In field names of more than one word, you could also capitalize each word and use no space between them, such as FirstName and LastName. As you build forms, reports, and other database objects that relate to the data in a table, you'll often make references to field names. Following a naming convention makes referring to field names in your database much easier because you know the format the field name uses. We'll cover some standard conventions for naming fields and other database objects in Chapter 2. Each field in a table can contain a specific type of data (the field's data type ). Data types include Text, Number, Date/Time, Currency, Yes/No, and others. By carefully defining fields, you can sim- plify data entry and lessen some of the effort required to maintain data. (We'll examine the data types that Access uses in more detail in the next section.) You can document the design of a da- tabase and provide some guidance for users with descriptions of the fields in a table. You can help ensure that data is entered in the correct format by setting some of a field's properties. You'll learn more about field properties shortly, and we'll cover them in detail in Chapter 3. To start defining our table, let's enter a couple of fields. We'll use this table (slightly modified) in the sample database we develop in later chapters. Enter fields in a table 1. 2. 3. In the Table Design window, click in the first row of the Field Name column, and enter Cam- paignID. Click in the Data Type column, and then select AutoNumber from the list of data types. Click in the Description column, and then enter A unique identifier for each marketing cam- paign. The Table Design window should look like this: 4. 5. Move down a row, and then enter the field name Language. For the field's data type, select Text, and for the field's description, enter The language for the campaign. Enter information for a third field, named LaunchDate. Select Date/Time as the field's data type, and then enter the description The date the campaign begins.