Transcript Access.01

Access Tutorial 1
Creating a Database
FIRST COURSE
Objectives
XP
• Define the terms field, record, table, relational
database, primary key, and foreign key
• Create a blank database
• Identify the components of the Microsoft Access
window
• Create and save a table in Datasheet view
• Enter field names and records in a table
datasheet
• Open a table using the Navigation Pane
New Perspectives on Microsoft Office 2007: Windows Vista Edition
2
Objectives
•
•
•
•
•
•
•
XP
Open an Access database
Copy and paste records from another Access database
Navigate a table datasheet
Create and navigate a simple query
Create and navigate a simple form
Create, preview, navigate, and print a simple report
Learn how to manage a database by compacting,
backing up, and restoring a database
New Perspectives on Microsoft Office 2007: Windows Vista Edition
3
Organizing Data
XP
• Your first step in organizing data is to identify the
individual fields
– Examples of fields: Birth date, Start date, course
name, grade earned, SSN, city, annual salary, title, lab
fee
– The specific value, or content, of a field is called the
field value
– A set of field values is called a record
New Perspectives on Microsoft Office 2007: Windows Vista Edition
4
Organizing Data
XP
• Next, you group related fields together into
tables
– Example of a table: Student table: Student last name,
student first name, student ID, birth date, start date,
score on math assessment exam, email address,
student major
New Perspectives on Microsoft Office 2007: Windows Vista Edition
5
Databases and Relationships
XP
• A collection of related tables is called a database, or a
relational database
– Examples of a database: Student database, Faculty database,
Inventory database
• Hierarchy of data organization
– Bits->Bytes->Fields->Records->Tables->Database
New Perspectives on Microsoft Office 2007: Windows Vista Edition
6
Databases and Relationships
XP
• You connect the records in the separate tables
through a common field
• A primary key is a field, or a group of fields, whose
values uniquely identify each record in a table
– Examples of a primary key field: SSN, Account #, Driver’s
License #, Airline Mileage Account #, Item #
• When you include the primary key from one table as
a field in a second table to form a relationship
between the two tables, it is called a foreign key in
the second table
New Perspectives on Microsoft Office 2007: Windows Vista Edition
7
Databases and Relationships
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
8
Databases and Relationships
XP
• On the previous slide
– The Customer table has 4 fields and 6 records
– The Contract table has 4 fields and 8 records
– There are 2 tables in the database
• A database can have one table or multiple tables
New Perspectives on Microsoft Office 2007: Windows Vista Edition
9
Relational Database Management
Systems
XP
• A database management system (DBMS) is a
software program that lets you create databases
and then manipulate data in them
• In a relational database management system,
data is organized as a collection of tables
New Perspectives on Microsoft Office 2007: Windows Vista Edition
10
Exploring the Microsoft Access
Window
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
11
Creating a Table in Datasheet View
XP
• Click the Create tab on the Ribbon
• In the Tables group, click the Table button
• Accept the default ID primary key field with the
AutoNumber data type, or rename the field and
change its data type, if necessary
• Double-click the Add New Field column heading,
and then type the name for the field you are
adding to the table
• Press the Tab key or the Enter key
New Perspectives on Microsoft Office 2007: Windows Vista Edition
12
Creating a Table in Datasheet View
XP
• Add all the fields to your table by typing the field names in
the column headings and pressing the Tab key or the
Enter key to move to the next column
• In the first row below the field names, enter the value for
each field in the first record, pressing the Tab key or the
Enter key to move from field to field
• After entering the value for the last field in the first
record, press the Tab key or the Enter key to move to the
next row, and then enter the values for the next record.
Continue this process until you have entered all the
records for the table
• Click the Save button on the Quick Access Toolbar, enter a
name for the table, and then click the OK button
New Perspectives on Microsoft Office 2007: Windows Vista Edition
13
Creating a Table in Datasheet View
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
14
Entering Records
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
15
Saving a Table
XP
• Click the Save button on the Quick Access
Toolbar. The Save As dialog box opens
• In the Table Name text box, type the name for
the table
• Click the OK button
New Perspectives on Microsoft Office 2007: Windows Vista Edition
16
Opening a Database
XP
• Start Access and display the Getting Started with
Microsoft Office Access page
• Click the More option to display the Open dialog
box
• Navigate to the database file you want to open,
and then click the file
• Click the Open button
New Perspectives on Microsoft Office 2007: Windows Vista Edition
17
Opening a Database
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
18
Navigating a Datasheet
XP
• The navigation buttons provide another way to
move vertically through the records
New Perspectives on Microsoft Office 2007: Windows Vista Edition
19
Creating a Simple Query
XP
• A query is a question you ask about the data
stored in a database
• The Simple Query Wizard allows you to select
records and fields quickly
New Perspectives on Microsoft Office 2007: Windows Vista Edition
20
Creating a Simple Query
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
21
Creating a Simple Form
XP
• A form is an object you use to enter, edit, and
view records in a database
• You can design your own forms, use the Form
Wizard, or use the Form tool to create a simple
form with one mouse click
New Perspectives on Microsoft Office 2007: Windows Vista Edition
22
Creating a Simple Form
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
23
Creating a Simple Report
XP
• A report is a formatted printout (or screen
display) of the contents of one or more tables in
a database
• The Report tool places all the fields from a
selected table (or query) on a report, making it
the quickest way to create a report
New Perspectives on Microsoft Office 2007: Windows Vista Edition
24
Creating a Simple Report
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
25
Creating a Simple Report
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
26
Creating a Simple Report
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
27
Printing a Report
XP
• Open the report in any view, or select the report in the
Navigation Pane
• To print the report with the default print settings, click
the Office Button, point to Print, and then click Quick
Print
or
• To display the Print dialog box and select the options
you want for printing the report, click the Office Button,
point to Print, and then click Print (or, if the report is
displayed in Print Preview, click the Print button in the
Print group on the Print Preview tab)
New Perspectives on Microsoft Office 2007: Windows Vista Edition
28
Viewing Objects in the Navigation Pane
New Perspectives on Microsoft Office 2007: Windows Vista Edition
XP
29
Access Objects
XP
• Table: holds the data
– recommend starting the filename with tbl (e.g.
tblContract)
• Query: asks a question about the data in a table
or another query
– recommend starting the filename with qry (e.g.
qryContract)
New Perspectives on Microsoft Office 2007: Windows Vista Edition
30
Access Objects (continued)
XP
• Form: displays record in a user-friendly format;
you could view the data using a table or a form.
Displays one record at a time unlike a table
which displays multiple records at one time
– recommend starting the filename with frm (e.g.
frmContract)
• Report: formatted printout (or display) of data in
a table or query; includes title, column heading,
page numbers, etc.
– recommend starting the filename with rpt (e.g.
rptContract)
New Perspectives on Microsoft Office 2007: Windows Vista Edition
31
When You Click on the Save Button
XP
• With Tables
– saves the design or structure of the table such as the data
type (text, currency, date); saves any formatting changes
(e.g. resize columns). The data is saved after a change is
made to each record
• With Queries
– saves the design view and formatting changes
• With Forms
– saves the design view and formatting changes
• With Reports
– saves the design view and formatting changes
New Perspectives on Microsoft Office 2007: Windows Vista Edition
32
Compacting and Repairing a Database
XP
• Compacting a database rearranges the data and
objects in a database to decrease its file size
New Perspectives on Microsoft Office 2007: Windows Vista Edition
33
Compacting and Repairing a Database
XP
• Make sure the database file you want to
compact and repair is open
• Click the Office Button, point to Manage, and
then click Compact and Repair Database
New Perspectives on Microsoft Office 2007: Windows Vista Edition
34
Backing Up and Restoring a Database
XP
• Backing up a database is the process of making a
copy of the database file to protect your
database against loss or damage
• The Back Up Database command enables you to
back up your database file from within the
Access program, while you are working on your
database
• To restore a backup database file, you simply
copy the backup from the drive on which it is
stored to your hard drive
New Perspectives on Microsoft Office 2007: Windows Vista Edition
35
Helpful Hints
XP
• Remember rows = records
• Remember columns = fields
• It is strongly recommended that you omit blank
spaces in field names; this will cause less
problems later in the course
– Good examples of field names are: LastName (best),
Last-name, Last_Name
– Bad examples of field names are: Last Name,
My Last Name, The Name Field
New Perspectives on Microsoft Office 2007: Windows Vista Edition
36
Helpful Hints
XP
• In Access, it is imperative that you close the DB
before you upload it. When the DB is open, there
are two files, the index file and the data file.
They work together. If you upload the data file
without the index, I can't open it much less read
it. Same is true for the reverse. So please CLOSE
the DB before uploading it.
New Perspectives on Microsoft Office 2007: Windows Vista Edition
37
Helpful Hints
XP
• Never remove the secondary storage device (e.g.
jump drive) that holds the database (DB) while
the DB is in use (i.e. open). Access automatically
saves changes in the data; if you remove the
storage device when the DB is open, the table
could be destroyed.
New Perspectives on Microsoft Office 2007: Windows Vista Edition
38
Helpful Hints
XP
• Naming filenames within a database
– Tables typically start with tbl
– Queries typically start with qry
– Forms typically start with frm
– Reports typically start with rpt
• It is strongly recommended that you follow these
standards starting now!
New Perspectives on Microsoft Office 2007: Windows Vista Edition
39
Helpful Hints
XP
• There are two views in Access:
– Data View
– Design View
• When the data changes, ACCESS automatically
saves these changes.
• When the design changes, YOU need to save
these changes.
New Perspectives on Microsoft Office 2007: Windows Vista Edition
40
Additional Examples
XP
• None
New Perspectives on Microsoft Office 2007: Windows Vista Edition
41