Office Access 2003: Creating A Database
Office Access 2003: Creating A Database
Lab 1
Creating a Database
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-5
Outline
Database Entering and editing table
Database data
Table Datasheet view
Queries Entering data
MS access Editing data
Creating a table Inserting a picture
Record, Field
Navigation
Field name Printing a table
Data types
Field properties
Primary key field
1-6
Concept Preview
• Database • Field Property
• Object • Primary Key
• Field Name • Graphic
• Data Type • Column Width
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-14
Outline
Database Entering and editing table
Database data
Table Datasheet view
Queries Entering data
MS access Editing data
Creating a table Inserting a picture
Record, Field
Navigation
Field name Printing a table
Data types
Field properties
Primary key field
1-15
Concept 1
Database
• Database – Organized collection of related
information
• Table – Vertical columns & horizontal rows
where information is stored
DATABASE
• Record (a row in a table)
– A group of related pieces of information about
one person, place, or thing
• Field
– (a column in a table, or an entry in a record)
– Smallest unit of information
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-16
Example
• Suppose we are a parts distributor.
• We have a list of suppliers that we work with,
a list of parts that we sell.
• For each supplier, we know their contact
address, what parts they supply, and at what
price.
• We also know the specification of each part.
• We want to create a database for this.
© 2007 P. Uthaisombut
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-17
Database
Supplier Table record
Supplier ID Supplier Name Supplier Address
100 Parts Universe Twintown, CA
105 Discount parts Pittsburgh, PA
Supply Table
112 Power Parts Kentmont, OK Supplier ID Part ID Price
© 2007 P. Uthaisombut
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-18
Queries
• List all the suppliers.
• List all the suppliers in CA.
• List all the suppliers who supply bolts.
• List all the suppliers who supply bolts for less
than $1.00.
• Count the number of parts supplied by Parts
Universe.
• Give the average price of screw from the
suppliers in PA.
© 2007 P. Uthaisombut
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-19
Mouse Pointer
Workspace
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-21
• Plan
• Design
• Develop
• Implement
• Review
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-22
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-23
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-25
Outline
Database Entering and editing table
Database data
Table Datasheet view
Queries Entering data
MS access Editing data
Creating a table Inserting a picture
Record, Field
Navigation
Field name Printing a table
Data types
Field properties
Primary key field
1-26
Outline
Database Entering and editing table
Database data
Table Datasheet view
Queries Entering data
MS access Editing data
Creating a table Inserting a picture
Record, Field
Navigation
Field name Printing a table
Data types
Field properties
Primary key field
1-27
Concept 2
Object
Object Use
Table Stores data
Database
Supplier Table record
Supplier ID Supplier Name Supplier Address
100 Parts Universe Twintown, CA
105 Discount parts Pittsburgh, PA
Supply Table
112 Power Parts Kentmont, OK Supplier ID Part ID Price
© 2007 P. Uthaisombut
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-29
Creating a Table
• The table object is the basic unit of a
database
• Must be created first before other
objects
• Cannot open more than one database
file at a time
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-30
1. Datasheet View
2. Design View
3. Table Wizard
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-31
Design View
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-32
Concept 3
Field Name
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-33
Database
Supplier Table record
Supplier ID Supplier Name Supplier Address
100 Parts Universe Twintown, CA
105 Discount parts Pittsburgh, PA
Supply Table
112 Power Parts Kentmont, OK Supplier ID Part ID Price
© 2007 P. Uthaisombut
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-34
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-35
Data types
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-36
Concept 4
Data Type
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-37
Data Types
Text AutoNumber
Memo Yes/No
Number OLE Object
Date/Time Hyperlink
Currency Lookup Wizard
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-38
Concept 5
Field Property
• Characteristic that
defines a field
• Each data type has
a set of properties
• Enhances the way
table works
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-39
Field Properties
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-40
Field description
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-41
Concept 6
Primary Key
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-42
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-43
Format sample
Format name
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-44
Defining a Field
• Field Name
– Supplier Name
• Data type
– Text
• Field property
– 30 Characters
–…
• (Primary key)
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-45
11 fields defined
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-46
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-47
Outline
Database Entering and editing table
Database data
Table Datasheet view
Queries Entering data
MS access Editing data
Creating a table Inserting a picture
Record, Field
Navigation
Field name Printing a table
Data types
Field properties
Primary key field
1-48
Outline
Database Entering and editing table
Database data
Table Datasheet view
Queries Entering data
MS access Editing data
Creating a table Inserting a picture
Record, Field
Navigation
Field name Printing a table
Data types
Field properties
Primary key field
1-49
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-51
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-52
Datasheet View
• Entering data
– Should be accurate and consistent
– Typed exactly as you want it to appear
• Editing data
– Position insertion point in field
– Use ESC to cancel changes
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-53
Concept 7
Graphic
We are pleased
to announce
the grand
opening of
Tom’s Deli
Photograph
Drawing Object
Clipart
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-54
Graphics
• Graphic
• Drawing object
• Picture
• Bound object
• Unbound object
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-55
Inserting a Picture
Create a new object
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-56
Preview
Changes dialog box view
Preview of
selected file
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-57
Picture opened in
graphics program
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-58
Navigating a Datasheet
Key Voice Movement
Right arrow key Tab or Right Next field
or Tab
Left arrow key or Shift tab or left Previous field
Shift +Tab
Downward arrow Down Current field in
key next record
Upward arrow Up Current field in
key previous field
Home Home First field in record
End End Last field in record
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-59
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-60
Concept 8
Column Width
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-61
Resizing a Column
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-62
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-63
Number of records
entered in data
entry
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-64
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-65
Deleting Records
Deletes selected
record
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-66
Outline
Database Entering and editing table
Database data
Table Datasheet view
Queries Entering data
MS access Editing data
Creating a table Inserting a picture
Record, Field
Navigation
Field name Printing a table
Data types
Field properties
Primary key field
1-67
Outline
Database Entering and editing table
Database data
Table Datasheet view
Queries Entering data
MS access Editing data
Creating a table Inserting a picture
Record, Field
Navigation
Field name Printing a table
Data types
Field properties
Primary key field
1-68
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-69
Mouse pointer
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-70
More on Preview
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-71
Page orientation
changed to landscape
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-72
Print Options
Option Action
All Prints the entire
document
Pages Prints pages you
specify by typing page
numbers in the textbox
Selected Records Prints selected records
only
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-73
Printing a
Selected page
Selected printer
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-74
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-75
Closing a Table
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-76
Main menu
and toolbar
buttons are
available
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-77
Opening a Database
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-78
Opening a Table
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-79
Exiting Access
• Click X in the upper right corner of the Access
window
• Menu equivalent is File/Exit
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-80
Outline
Database Entering and editing table
Database data
Table Datasheet view
Queries Entering data
MS access Editing data
Creating a table Inserting a picture
Record, Field
Navigation
Field name Printing a table
Data types
Field properties
Primary key field
1-81
Key Terms
• active window • database
• Best Fit • Database toolbar
• bound object • drawing object
• cell • datasheet
• clip art • data type
• column width • field
• current field • field name
• current record • field property
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-82
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-83
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-84
FAQs
1. What is a relational database?
2. What is the difference between a table
and a file?
3. Does a database contain one table or
several tables?
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-85
FAQs
4. The My Document folder has several
files called db1, db2, db3, etc. What
are these?
5. What other Access objects are in a
database besides tables?
6. What is a primary key?
7. I am ready to enter my data into
Access. What do I need to do first?
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-86
FAQs
8. How can I get the state code of my
state to be entered automatically in a
field?
9. I want to enter dates using the MM-
DD-YY format. Is there an easy way to
do this?
10. I forgot a field in my table and now I
want it positioned in the middle of the
table. How can I do this?
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-87
Discussion Questions
1. Discuss several uses you may have for
a relational database. Explain the
steps you would follow to create your
first table.
2. Discuss why it is important to plan a
database before creating it. How can
proper planning save you time later?
3. Discuss the difference between Edit
mode and Navigation mode.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
1-88
Discussion Questions
4. Design view and Datasheet view are
two views in Access. Discuss when it
would be appropriate to use each of
these views.
5. Discuss why it is important to choose
the correct data type for a field. What
may happen to the data if you change
the data type?
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.