Professional Documents
Culture Documents
The Visibooks Guide To Access 2003 (2006) PDF
The Visibooks Guide To Access 2003 (2006) PDF
TABLE OF CONTENTS i
Working with Forms ....................................131
Modify forms ...................................................................................... 132
Add/delete records ............................................................................ 146
Edit records........................................................................................ 150
Find records....................................................................................... 153
Filter records...................................................................................... 156
ii TABLE OF CONTENTS
Database Basics
In this section, youll learn how to:
DATABASE BASICS 1
Create a new database
1. Start Microsoft Access 2003.
2 DATABASE BASICS
2. In the Getting Started pane, click Create a new file.
DATABASE BASICS 3
3. When the New File pane appears, click Blank Database.
4 DATABASE BASICS
4. When the File New Database window appears, create a new
folder in the My Documents folder called Practice Access
Files.
DATABASE BASICS 5
5. Double-click the Practice Access Files folder.
6 DATABASE BASICS
6. In the File name box, type:
Friends.mdb
Just like Word files are something.doc, and Web pages are
somethingelse.html, Access databases are database.mdb.
DATABASE BASICS 7
7. Click the button.
8 DATABASE BASICS
Identify database elements
Elements of databases
Form Query
Table Table
Report
DATABASE BASICS 9
1. In the Objects list, click Tables.
2. Click Queries.
10 DATABASE BASICS
3. Click Forms.
4. Click Reports.
DATABASE BASICS 11
5. Click Tables.
12 DATABASE BASICS
Create tables
1. Double-click Create table by entering data.
DATABASE BASICS 13
Name fields
2. Type:
First Name
14 DATABASE BASICS
4. Double-click the Field2 column header.
5. Type:
Last Name
City
DATABASE BASICS 15
8. Double-click the Field4 column header, type:
Zip
Phone Number
16 DATABASE BASICS
Delete unused fields
DATABASE BASICS 17
3. When the alert window appears, click the button.
5. Delete the Field8, Field9, and Field10 columns the same way.
18 DATABASE BASICS
6. On the Menu Bar, click File, then Save.
Friends of Mine
DATABASE BASICS 19
9. When the alert window that reads There is no primary key
defined appears, click the button.
The ID field is now the tables primary key, or key field. That means it
cant contain any duplicates.
That way, if it has more than one patient named John Baker, it can
easily distinguish John Baker, ID #326 in for a checkup, from John
Baker, ID #298 who needs his gall bladder removed.
20 DATABASE BASICS
Create records
1. Click in the box under the First Name column header.
2. Type:
Elvis
4. Type:
Presley
5. Type:
Baltimore
DATABASE BASICS 21
6. Type:
21212
7. Type:
4105551212
Tip: Notice how the cursor in the row selector has moved down
to the second (new) record. When you move on to a new record,
Access automatically saves the previous record.
22 DATABASE BASICS
Add new fields
The table should now look like this, with a new blank field:
State
DATABASE BASICS 23
5. Click inside the new State field for the first record.
6. Type:
MD
24 DATABASE BASICS
Move fields
Then drag the column so the cursor rests between the Last
Name and City columns.
3. When you see a thick black line between the two columns,
release the mouse button.
The Phone Number column should now rest between the Last
Name and City columns:
DATABASE BASICS 25
4. On the Menu Bar, click File, then Close.
5. When prompted to save the changes to the table layout, click the
button.
26 DATABASE BASICS
The Friends database window should now look like this:
DATABASE BASICS 27
Create forms
1. In the Objects list, click Forms.
28 DATABASE BASICS
3. When the Form Wizard window appears, click the button.
DATABASE BASICS 29
All the table fields should be added to the form:
30 DATABASE BASICS
5. When the next screen appears, leave Columnar selected, then
click the button.
DATABASE BASICS 31
6. When the next screen appears, make sure Standard is selected,
then click the button.
32 DATABASE BASICS
7. When the last screen appears, type:
in the box.
DATABASE BASICS 33
8. Click the button.
34 DATABASE BASICS
Add a new record
DATABASE BASICS 35
2. Press TAB to advance to the First Name box.
3. Type:
Bo
4. Type:
Diddley
5. Type:
Richmond
6. Type:
VA
36 DATABASE BASICS
7. Type:
23220
8. Type:
8005557890
DATABASE BASICS 37
9. Press the TAB key again.
38 DATABASE BASICS
10. On the Menu Bar, click File, then Close to return to the database
window.
DATABASE BASICS 39
Create queries
Whats a query?
Essentially, its a question. You use queries to ask the database things
like, Who are my customers in Montana?, or How many pipe fittings
have I sold this month?
40 DATABASE BASICS
2. Double-click Create query by using wizard.
DATABASE BASICS 41
First Name should appear in the Selected Fields column:
42 DATABASE BASICS
4. Click the button.
This should add the Last Name field to the Selected Fields list:
DATABASE BASICS 43
5. Double-click Phone Number.
44 DATABASE BASICS
This should add the Phone Number field to the Selected Fields
list:
DATABASE BASICS 45
7. When the final screen appears, type:
9. On the Menu Bar, click File, then Close to return to the database
window.
46 DATABASE BASICS
Create reports
1. In the Objects list, click Reports.
DATABASE BASICS 47
3. When the Report Wizard window appears, click the
Tables/Queries drop-down arrow.
48 DATABASE BASICS
4. Click the button to move all the fields into the Selected
Fields list.
DATABASE BASICS 49
5. In the Selected Fields list box, click ID, then click the
button.
50 DATABASE BASICS
7. When the next screen appears, click the button.
DATABASE BASICS 51
8. When the next screen appears, click the first drop-down arrow,
then click State in the list.
52 DATABASE BASICS
Choose layout and style
DATABASE BASICS 53
2. When the next screen appears, click Soft Gray in the list of
available styles.
54 DATABASE BASICS
View the report
My Friends
in the box.
DATABASE BASICS 55
2. Click the button.
3. On the Menu Bar, click File, and then Close to return to the
Friends database window.
56 DATABASE BASICS
4. On the Menu Bar, click File, then Exit to close Access.
DATABASE BASICS 57
Practice: Database Basics
1. Open Microsoft Access.
CD Title
Artist
Genre
Date Purchased
Number of Songs
58 DATABASE BASICS
7. Enter these data into the table to create the first record:
11. Use the form to enter information for four more CDs.
DATABASE BASICS 59
12. Create a query that pulls out this information:
CD Title
Genre
Number of Songs
16. Include all the fields of the CDs table in the report, and sort the
records based on Genre.
60 DATABASE BASICS
17. Name the report CD Inventory.
DATABASE BASICS 61
62 DATABASE BASICS
Working with Tables
In this section, youll learn how to:
Modify tables
Create new tables
Specify data types
Specify field properties
Edit records
Find records
Sort and filter records
Create table relationships
www.visibooks.com/books/acc2003
2125551515
The Input Mask for the Phone Number field should now look like
this:
13. When the alert window appears, click the button to save
the Customers table.
14. Use the TAB key to move across the first record until you are in
the Phone Number field.
3015551212
16. Press the TAB key four times to move to the next record.
3. Double-click.
Order ID
Orders
1. In the Data Type column beside the Order ID field, click the
drop-down arrow.
Order Date
This list can come from a table or query, or list items can be specified
manually.
Customer
2. In the Data Type column, click the down arrow, then Lookup
Wizard
The Lookup Wizard should show how the field will look with data
in it:
Customer Name
Unit L
BBC
4. In the Match list, click the drop-down arrow, then Any Part of
Field.
The Customers table should now look like this, with BBC
highlighted:
The Customers table should now look like this, with the
customer ID numbers arranged in ascending order:
The Customers table should now look like this, showing all
customers whose State is Florida:
But unlike a query, your filtering doesnt remain part of the database.
When you perform a query and save it, the query remains with the
database, even after you close it. Filtering does not.
Since you cant save filtering like a query, filter records when you need
quick results. Think of filtering as a temporary, quick, on the spot
query.
Relationships are links that associate a field in one table with a field in
another.
Students
Classes
Students
Student Name Address
John Elm St.
Jane Oak St.
The Math Class table holds information about the students in math
class:
Math Class
Student Name Grade
John A
Jane B
By linking the Student Name fields, you make sure that John in the
Students table is the same John listed in the Math Class table:
6. Double-click Orders.
1. Place the cursor on the Title Bar at the top of the Employees
table.
4. Click the Order ID field in the Order Details table, then drag it
and rest it on top of the Order ID field in the Orders table.
Artist ID (Autonumber)
Artist Name (Text)
Band or Solo Artist? (Lookup Wizard)
Good Artist? (Yes/No)
Band
Solo Artist
Track ID (Autonumber)
Album ID (Text)
Track Name (Text)
Track Length (Text)
Favorite Track on Album? (Yes/No)
12. Change the data type of the Date Purchased field to Date/Time,
and its format to Short Date.
Tip: An alert window will appear saying there was an error, due
to switching the Artist data type to Number. Click the
button.
16. Link the Artist ID fields of the Artists and CDs tables.
18. Link the Album ID field of the CDs table to the Album ID field in
the Tracks table.
Modify forms
Add/delete records
Edit records
Find records
Filter records
2. Position the cursor over the move handle of the Address 2 box.
4. Position the cursor over the move handle of the Address 2 label.
2. Press and hold down the SHIFT key, then click the Address 2
text box.
4. Type:
Street Address
Amy Preston
Preston Publishing
1214 North Ave.
Suite 118
Redmond, WA 98049
4255556113
4255557441
[email protected]
Tip: Using the TAB key to move through the form doesnt
access the field in the right sequence.
3. When the Tab Order window appears, click and drag the row
headers to place the fields in correct order.
2. Type:
Metro-Corp
www.visibooks.com/books/acc2003
2. Right-click the Music Library 2.mdb link, and save the database
in the Practice Access Files folder.
5. Using the Form Wizard, create a new form based on the Artists
table, using all the fields.
Create queries
Sort results
Add criteria
Employ Boolean operators
Find duplicate records
Create Update queries
Create Delete queries
This adds the Customers table to the query. The query window
should look like this:
1. Drag the Customer ID field from the Customers table to the first
column of the query design grid.
The query is now set up to show the Customer ID, First Name,
and Last Name of each customer in the Customers table.
FL
If this field held date data, Access would have surrounded it with
hash marks (#).
If you had a T-shirt store with an Access database, for instance, and
you wanted to find out how many of your California customers had
ordered blue T-shirts, youd employ the AND operator in your query:
If you wanted to see how many customers were from California (these
California customers could have bought T-shirts of any color),
and how many customers bought blue T-shirts (these blue T-shirt
customers could be from anywhere),
2. In the State field, click in the or row under the criterion FL.
3. Type:
MD
Drag it from the field list in the Customers table and drop it in
the blank field to the right of the State field in the design grid.
5. Type:
A*
There are two identical entries for Jane Doe in the database.
1. Click the row selector button for the Jane Doe record with the
Customer ID of 7.
Tip: Deleting a record from a query also deletes it from the table
it was stored in.
It should now look like this, with only one record for Jane Doe:
2. Note the price (to customers) of French Truffles ($8.99) and Blue
Mountain Coffee ($9.99).
3. Note the cost (to the store) of French Truffles ($6.15) and Blue
Mountain Coffee ($8.00).
[Cost]*1.25
17. On the Menu Bar, click File, then Close to return to the
FoodStore1 database window.
1. In the Last Name column of the design grid, click in the Criteria
row.
2. Type:
Gumman
You may want to run the query as a regular query first, to verify
its choosing the correct records, and then switch the type to a
Delete query.
Note that Tom Gumman and Tina Gumman are no longer listed
as employees.
10. Add the Good Artist? field to the design grid area.
Format reports
Create mailing labels
www.visibooks.com/books/acc2003
5. Click it again.
2. Place the cursor in the vertical ruler bar beside the Customer
Name label.
0.5
0.5
Shipping Labels
in the box.
Tip: If you receive a warning box saying Some data may not be
displayed, you can click the OK button and ignore it. Your labels
should still look like the picture above.
2. Create a new report based on the CDs table using the Report
Wizard.
5. Sort by Title.
9. Change the font for the heading of the report to Arial Black.
Data
A series of facts. When data is organized, it becomes useful information,
which can be processed and used to draw conclusions.
Database
A collection of information organized into tables of data.
Field
A single unit of data stored as part of a database record.
Form
A database object primarily used to enter or display data.
Key Field
A field in a table that can contain no duplicates. The key field is each
records unique identifier.
Query
A set of questions presented to a database to retrieve specific information.
Record
One row in a given table. In a relational database, records correspond to
rows in each table.
Relationship
An association established between common fields in two tables.
236 GLOSSARY
Report
Presents information retrieved from a table or query in a preformatted,
easy-to-read way.
Select Query
A query that asks a question about the data stored in tables, and provides a
result in the form of a datasheet.
Table
A collection of rows and columns that organize data.
Update Query
A query that changes a set of records according to specified criteria.
GLOSSARY 237
238 GLOSSARY
Where to Get Visibooks
If you liked using this book, and would like to use more like it, visit:
www.visibooks.com
Computer Basics
Microsoft Office
Desktop Linux
OpenOffice.org
Web Site Layout
Web Graphics
Web Programming
www.visibooks.com