Post on 14-Dec-2015
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Office Access 2003Lab 2
Modifying a Table and Creating a Form
Quiz 3: Access Chapter 1
Monday
2-2
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Objectives
1. Navigate a large table.
2. Change field format properties.
3. Set default field values.
4. Insert a field.
5. Define validation rules.
2-3
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Objectives continued
6. Hide and redisplay fields.
7. Find and replace data.
8. Use Undo.
9. Sort records
10.Format a Datasheet.
2-4
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Objectives continued
11.Create a form to simplify data entry.
12.Preview, print, close, and save a form.
13. Identify object dependencies.
14.Add file and object dependencies.
15.Add file and object documentation.
2-5
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Concept Preview
• Format Property• Default Value
Property• Validity Rule• Expression
• Find and Replace• Sort• Form
2-6
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Outline
• Navigating a Large Table– Moving Using the Keyboard– Moving Using the Navigation Buttons– Moving Between Fields
2-7
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Outline continued
• Customizing and Inserting Fields– Setting Display Formats– Setting Default Values– Inserting a Field– Defining Validation Rules
• Hiding and Redisplaying Fields– Hiding Fields– Redisplaying Hidden Fields
2-8
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Outline continued
• Finding and Replacing Data– Finding Data– Using Undo– Replacing Data
• Sorting Records– Sorting on a Single Field– Sorting on Multiple Fields
2-9
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Outline continued
• Formatting the Datasheet– Changing Background and Gridline Color– Changing Text Color
• Creating and Using Forms– Using the Form Wizard– Navigating in Form View– Adding Records in a Form
2-10
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Outline continued
• Previewing and Printing a Form– Printing a Selected Record
• Identifying Object Dependencies
• Setting Database and Object Properties– Documenting a Database
2-11
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Outline continued
• Key Terms
• FAQs
• Discussion Questions
2-12
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Navigating a Large Table
Total records in table
2-13
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Moving Using the KeyboardKeys Effect[Page Down] Down one page
[Page Up] Up one page
[Ctrl] + [Page Up] Left one window
[Ctrl] + [Page Down] Right one window
[End] Last field in record
[Home] First field in record
[Ctrl] + [End] Last field of last record
[Ctrl] + [Home] First field of first record
[Ctrl] + [up arrow] Current field of first record
[Ctrl] + [down arrow] Current field of last record
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
2-14
Moving Using the Navigation Buttons
Button EffectFirst record, same field
Previous record, same field
Next record, same field
Last record, same field
New (blank) record
2-15
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Moving Between Fields
2-16
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Customizing and Inserting Fields
• Add and delete fields
• Add restrictions on data
• Define how data will be displayed
2-17
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Setting Display Formats
2-18
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Concept 1
• Used to specify the way data are displayed and printed
• Does not change the way Access stores data, only the way it is displayed
• Can create a custom format or choose from predefined formats
Format Property
2-19
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Predefined Formats Text and Memo Data Types
Symbol Meaning Example
@ Required text character or space
@@@-@@-@@@@
123456789 as 123-45-6789
> Forces to uppercase
smith as SMITH
< Forces to lowercase
SMITH as smith
& Optional text character
@@-@@&
12345 as 12-345
Check page 9
2-20
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Concept 2
• Used to specify a value when a new record is created
• Used when most of the entries in a field will be the same for the entire table
• Users can accept this value or enter another value
• Saves time while entering data
Default Value Property
2-21
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Setting the Default Value
2-22
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Inserting a Field
New field inserted and defined
2-23
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Concept 3
• Validation rules• Used to control the data that can be entered
in a field• Expression that defines acceptable data
• Validation checks are done automatically• Validation text
• Message that appears if invalid data is entered
• Can create your own message or use default message
Validation Rules
2-24
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
• An expression is a formula consisting of symbols.
• Produces a single value
• Create an expression by combining– identifiers– operators– values
Concept 4Expression
2-25
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Comparison Operators
Operator Meaning
= Equal to
<> Not equal to
< Less than
> Greater than
<= Less than or equal to
>= Greater than or equal to
2-26
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Expression Examples
Expression Result
=[Sales Amount] + [Sales Tax]
Sums value in two fields
=“F” OR “M” Includes F or M entries only
>=#1/1/99# AND <=#12/31/99# Greater than or equal to 1/1/99 and
less than or equal to 12/31/99
=“Workout Gear” Includes the entry Workout Gear only
2-27
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Entering an Expression
Expression Error message text
2-28
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Valid Entries
Error message appears when an invalid entry is made
2-29
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Hiding And Redisplaying Fields
• Hide fields to see more on screen– Choose Format/Hide
• Redisplay hidden fields – Choose Format/Unhide
2-30
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Hiding Fields
Street field through phone field is hidden
2-31
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Redisplaying Hidden Fields
Hidden fields are not selected
2-32
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
• Quickly finds specific information
• Automatically replaces value with new information
• Find Command– Locates all specified values in a field
• Replace Command– Finds a value and replaces it with another
Concept 5Find and Replace
2-33
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Finding Data
Enter text to find
2-34
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Find and ReplaceDialog Box Options
Option Effect
Look in Searches current field or entire table
Match Locates matches
Search Specifies the direction in which the table will be searched
Match case Case-sensitive search
Search fields as formatted
Finds data based on its display format
2-35
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Finding Data
Find occurrence of located text
2-36
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Using Undo
• Undo will cancel your last action as long as you have not made any further changes
• Can undo if record has been saved by using Undo Saved Record
Original name restored
2-37
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Replacing Data
• Search table to find data
• Replace one entry with another
• More efficient than searching one record at a time
2-38
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Find & Replace
Replacement text
2-39
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
• Rearrange a table's records by sorting in a different order
• Sorting helps you find information quickly
• Can sort by a single field or by multiple fields
Concept 6Sort
2-40
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Sorting on a Single Field
Ascending order
Sorting options
2-41
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Sorting on Multiple Fields
Records sorted by last name and by first name within the
same last name
2-42
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Formatting the Datasheet
• Enhance the appearance of the datasheet by applying formatting options
• Can change the appearance of– Cells– Gridlines– Background and gridline colors– Border and line styles
• Datasheet formats affect the entire datasheet
2-43
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Changing Background and Gridline Color
Sample of selected background and gridline color
2-44
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Changing the Text Color
Adds bold Adds background color
Changes text color
2-45
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Concept 7
• A form is a database object used to display records onscreen
• Forms are based on underlying tables
• Include design control elements– Descriptive text– Titles & labels– Lines, boxes, and pictures
• Forms can use calculations
Forms
2-46
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
A form provides an easy way to enter and display the data stored in a table.
You can see all of the fields in a single record without scrolling.
Form View Design View
- Three types of controls (objects): A bound control: has a data source. Unbound control: no data source, used to display title, label. A calculated control: contains an expression rather than field( +,-, /)
2-47
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Form Design View
Click and drag to move Toolbox
Sizing handles
2-48
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Form View
Current Record Total Number of Records
2-49
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
The Form Wizard
• An easy way to create Access forms
• Select fields from underlying table
• Place fields in tab order – the order you want them to appear on the form
• Select layout
• Select style
• Enter a name for the form
2-50
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Using the Form Wizard
Fields in selected table
Table to use as source for forms
Specify fields to display in forms
2-51
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Select Fields
First field to displayin formAdds all fields to form
Adds selected field to form
2-52
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Select Form Layout
2-53
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Form Layout Style Description
Columnar Presents data in columns
Tabular Presents data in a table layout
Datasheet Selected data in rows and columns
Justified Presents data in rows
Layout Style
2-54
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Form StyleSample of selected style
Form styles
2-55
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Enter Name for Form
Enter name for form
2-56
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Completed Form
Form view toolbar
Formatting toolbar
View
2-57
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Viewing Data
Field data
Field names
2-58
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Navigating in Form View
• Use the same navigation keys in Form view that are used in Datasheet view
• Move between fields by using– TAB– ENTER– SHIFT +TAB– The directional keys on the keyboard
2-59
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Finding a Record in Form View
Picture displayed in form
2-60
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Adding Records in a Form
Use form to enter a new record
2-61
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Previewing and Printing a Form
Print Preview displays the view you were using last
2-62
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Printing a Selected Record• Display record in
the form
• Click the selector bar to select the record
• Next, select File/Print
Record selector bar
2-63
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Identifying Object Dependencies
• A form is an object added to the database
• Many objects are dependent on other objects– A form is dependent on the database table– A form needs a table for content data
2-64
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Dependencies from view menu
Object Dependencies task pane
Shows objects depends on the Employee Records table
2-65
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Documenting a Database
• Title
• Subject
• Author
• Keywords
• Comments
2-66
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
File Properties
2-67
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Key Terms
• character string• comparison operator• Default Value
property• expression• Find and Replace• form• format
• Format property• identifier• operator• sort• tab order• validation rule• validation text• value
2-68
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
FAQs1. I typed the name data in lower case in
my table and now I would like the name to be in upper case. Is there an easy way to do this?
2. How do I make sure a certain value is entered in a field?
2-69
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
FAQs
3. My table is large and I can't see all the fields on the screen. Any suggestions?
4. How does the Undo command work in Access?
2-70
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
FAQs5. How can I sort on more than one field?
6. How can I enhance the appearance of my datasheet?
7. What is a form and how do I use it?
8. Are forms required in order to view the data and add records in a database?
2-71
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Discussion Questions
1. Discuss several different format properties and how they are used in a database.
2. Discuss the different types of form layouts and why you would use one layout type over another.
2-72
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.
Discussion Questions
3. Discuss how validity checks work. What are some advantages of adding validity checks to a field? Include several examples.
4. Discuss the different ways records can be sorted. What are some advantages of sorting records?