22
Access Lesson 2 Creating a Database Microsoft Office 2007: Introductory Pasewark & Pasewark 1

Access lesson 2

  • Upload
    audrey

  • View
    633

  • Download
    1

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Access lesson 2

1

Access Lesson 2Creating a DatabaseMicrosoft Office 2007: Introductory

Pasewark & Pasewark

Page 2: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

2

Objectives•Create a database.•Design, create, and save a table in

Datasheet view.•Set a field’s data type in Datasheet view.•Add, delete, rename, and move fields in

Design view.•Set field properties in Design view.

Pasewark & Pasewark

Page 3: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

3

Vocabulary

•Alphanumeric data•AutoNumber•Blank Database template•Data type•Default Value property

Pasewark & Pasewark

Page 4: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

4

Vocabulary (continued)

•Description property

•Design grid•Design view•Field Properties pane

•Field property

•Field Size property

•Format property•Primary key•Required property

•Template

Pasewark & Pasewark

Page 5: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

5

Creating a Database• The first step in

creating a database is to create the file that will hold the database objects.

• You can use a template that already has objects in it.

• You can also use a Blank Database template with no objects in it.

Pasewark & Pasewark

Page 6: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

6

Creating a Database (continued)

• To create a database, start Access.

• On the Getting Started with Microsoft Access page, double-click the template you want to use.

• Specify a file name and storage location.

• Click Create to create the new database and open it in Access.

Pasewark & Pasewark

Page 7: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

7

Creating and Saving a TableIn Datasheet View• When you create a blank database, Access

creates the first table and names it Table1.• You can change the name when you save it.• To save, click the Save button on the Quick

Access Toolbar. Fill in the name in the Save As dialog box.

• The new table name appears on the tab for the table and as an object in the Navigation Pane.

Pasewark & Pasewark

Page 8: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

8

Designing a Table in Datasheet• After creating a table, you need to tell Access

what fields to include.• Access creates one field named ID and sets it as

the primary key.• A primary key is the field that contains a unique

field value for each record.• In some tables, this field is called AutoNumber

because it automatically adds a unique number.

Pasewark & Pasewark

Page 9: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

9

Pasewark & Pasewark

Page 10: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

10

Designing a Table (continued)• You can tell that Access created an AutoNumber

for the ID field because of the word New in the first record’s field.

• Good candidates for being a primary key are▫ Employee numbers▫ Social security numbers ▫ Student ID numbers

• The advantage of setting a primary key is that Access will not let you enter duplicate values for this field in different records.

Pasewark & Pasewark

Page 11: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

11

Pasewark & Pasewark

Page 12: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

12

Designing a Table (continued)• To enter a field name in Datasheet view, double-

click the “Add New Field” field selector.• After you have created all the fields, you can

enter the first record.• Access assigns a data type as you enter data

(Text, Memo, Number, etc.).• You can change the data type for a field by

clicking the Data Type arrow in the Data Type & Formatting group on the Table Tools Datasheet tab.

Pasewark & Pasewark

Page 13: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

13

Working in Design View

• In Design view you can add, delete, and make changes to how fields store data.

• The field names and data types appear in the upper half in a design grid.

• The Field Properties pane appears below.

• A selected field turns orange. The primary key has a key symbol in it.

Pasewark & Pasewark

Page 14: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

14

Pasewark & Pasewark

Table in Design View ( Behind the Scene)

Unique IDLike SS#

Page 15: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

15

Working in Design View (continued)• You can use the options in the Tool group on

the Table Tools Design tab to:▫ Add and delete fields, insert a field▫ Drag fields in the design grid to a new location▫ Rename a field, and change a field’s data type

• The Description property in the design grid is optional, and you can use it to describe what to enter in the field.

• Any changes made in Design view are automatically updated in Datasheet view when you save the table.

Pasewark & Pasewark

Page 16: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

16

Changing Field Properties in Design View

• A field property describes the field’s contents beyond the field’s basic data type, such as:▫ Indicating number of characters allowed▫ Indicating allowable values

• Field properties will vary depending on the field’s data type.

• The Field Size property sets the number of characters you can store in a Text, Number or AutoNumber field.

• There is an array of Field Size property options including the ability to store decimals, positive numbers, negative numbers, or whole numbers.

Pasewark & Pasewark

Page 17: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

17

Pasewark & Pasewark

Page 18: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

18

Pasewark & Pasewark

Page 19: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

19

Changing Field Properties in Design View (continued)

• Use the Format property to specify how you want Access to display numbers, dates, times and text.

• For example, if you enter the date 10-28-10, Access will display it as October 28, 2010, if the Format property is set that way.

• The Default Value property enters the same field value in a field every time a new record is added to a table.

• The Required property specifies whether you must enter a field value in a record.

Pasewark & Pasewark

Page 20: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

20

Summary

• Creating a database creates a file that will store database objects. You can create a database using a template or a Blank Database template.

• You can create a table in Datasheet view by entering the field names, and then entering the first record.

• Access assigns the data type as you enter data. Access also creates an ID field to serve as the table’s primary key. The primary key is the field that contains unique field values for every record in a table.

Pasewark & Pasewark

Page 21: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

21

Summary (continued)•To save a table, click the Save button on

the Quick Access Toolbar. •A field’s data type determines the type of

data that can be entered, including text, numbers, or a combination of both.

•The data types for Access are Text, Memo, Number, Date/Time, Currency, AutoNumber, Yes/No, OLE Object, Hyperlink, Attachment and Lookup Wizard.

Pasewark & Pasewark

Page 22: Access lesson 2

Ac

ces

s –

Les

so

n 2

Microsoft Office 2007: Introductory

22

Summary (continued)• In Design view you can add, delete and rename

fields.• A field property describes a field beyond the data

type. The properties you can set depend on the data type. Additional properties include:▫ Description property describes the field▫ Field Size property sets # of characters/numbers▫ Format property sets formatting (i.e. date format)▫ Required property is used when a field must contain

data

Pasewark & Pasewark