View
231
Download
2
Category
Preview:
Citation preview
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-1
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
DESIGNING THE STRUCTURE OF TABLES
Microsoft Access 2007 – Level 2Microsoft Access 2007 – Level 2
Chapter 1Chapter 1
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-2
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Performance Objectives
• Design the structure of tables to optimize efficiency and accuracy of data
• Select the appropriate field data type based on analysis of data
• Add captions to fields for descriptive purposes• Disallow blank field values• Allow or disallow zero-length strings in a field• Create a custom format for text, number, and date
fields• Create a custom input mask• Define rich text formatting for a memo field• Store history of changes to a memo field• Define and use an attachment field with multiple
attachments
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-3
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Designing Tables and Fields
1. Determine data needed from existing or future reports, forms, or queries
2. Compile a data dictionary from that data3. Map out the tables and fields for each table
– Each table (entity) should describe a person, place, object, event, or other subject only
– Segment data to its smallest unit for maximum flexibility (Example: first name, last name should be two fields)
– Do not include fields that can be calculated– Identify Yes/No or True/False fields– Identify which field will contain unique data; it
becomes the primary key field – Determine table relationships and common fields– Avoid data redundancy
Plan!
Plan!
Plan!
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-4
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Diagramming a Database
To have a visual representation of the structure
Recommend ---easier to type
into expressions
Common fields in tables
Abbreviate field namesNo spaces in field names
Primary key fields indicated
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-5
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Assigning Data Types
• The Data Type restricts the data that can be entered into a field– Only numbers can be entered into Number,
Currency, or Date/Time fields– Only alphanumeric text can be entered into Text
or Memo fields (if numbers are entered, they are stored as text)
• Select the appropriate Data Type for each field– Changing the data type after data has been
entered can cause some loss of data
In Table Design View, click on the desired field to view its Data Type property
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-6
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Assigning Data Types…/2
Data Type Description
Text Length limit up to 255 characters; alphanumeric
Memo Length limit up to 65,535 characters; alphanumeric; supports rich text formatting
Number Positive or negative value that can be used in calculations
Date/Time Accepts only valid dates or times
Currency Monetary value; does not round off during calculations
AutoNumber Value assigned by Access automatically when a new record is added
Yes/No Restricts entry to Yes/No, True/False. Or On/Off
OLE object Stores an embedded or linked object created in other Microsoft Office applications
Hyperlink Links to a URL
Attachment Attach a file to the record, such as a picture, Word document or Excel worksheet
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-7
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
Using the Field Size Propertyto Restrict Field Length
• Restrict data entry in a field to no more characters than the number in the Field Size property
• Default field size varies depending on the data type– Text: default field size is 255 characters– Number: default field size is Long Integer
• Access stores only the number of characters entered, even when Field Size is greater
• Field Size can be reset in the properties for each field (Be careful not to lose data!)
The Field Size Property
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-8
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Using Field Properties
List of Field Properties is based on the Data Type
Partial list of Text field properties
Hint: Define properties before creating queries, forms, and reports
Type a descriptive title for headings in
datasheets, queries, forms, reports
Set to Yes to require an entry in this field
To store a zero-length field instead of a null value for an empty
field
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-9
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
Creating a Custom Format for a Text Field
Does not affect how data is stored
Partial list of Text field properties Enter Format codes
Code Description
@ Placeholder for each character; character is required
! Fill left to right instead of right to left
> Convert to uppercase
< Convert to lowercase
[color] Show text in specified font color (black, blue, red, green, cyan, magenta, yellow, white)
To customize how text is displayed in a datasheet, query, form, or report
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-10
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Text Field Format Examples
Entry Format Result
123 @@@@@ Two spaces, followed by 123, all left-aligned
123 !@@@@@ 123, followed by two spaces, all left-aligned
>@@@@@ abc12 ABC12
< SMITHSONIAN smithsonian
111223333 [blue]@@@-@@-@@@@ 111-22-3333
abcde >@@ ABCDE, the first two characters are required and capitalized
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-11
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
Creating a Custom Format for a Numeric Field
Does not affect how data is stored
Partial list of Number field properties Enter Format codes
Code Description
# Placeholder for each digit; does not restrict the number of digits entered
0 Placeholder for each digit; shows a zero for digits not entered
% Multiplies the value by 100 and adds a percent symbol
To customize how a number is displayed in a datasheet, query, form, or report
More codes available – see Help
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-12
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Number Field Format Examples
Entry Format Result
123456.70 #.## 123456.70
12 0.00 12.00
123456.7 #,###.#0 123,456.70
0 00.00 00.00
-500 #,###;(#,###)[red] (500)
ab123 >@@### AB123
Number formats may have up to 4 parts:
#,###.00;-#,###.00[red];0.00;’Unknown’
Positive values
Negative values
Zero values
Null value
s
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-13
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
Creating a Custom Format for a Date/Time Field
Date and Time are stored as a number;
a field can display Date only, Time only, or both
List of Date/Time field properties
Enter Format codes
To customize how a Date and/or Time is displayed in a datasheet, query, form, or report
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-14
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Date/Time Built-in Formats
FormatFormat DescriptionDescription
General Date
Example: 3/31/2009 5:34:23If a date only is entered, no time is displayed; if a time only is entered, no date is displayed
Long Date Example: Friday, March 31, 2009
Medium Date Example: 31-Mar-09
Short Date Example: 3/31/2009
Long Time Example: 7:34:33 PM
Medium Time Example: 7:34 PM
Short Time Example: 19:34
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-15
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Date/Time Custom Format Codes
Code Description
d dd
ddddddd
Displays the day of the month; d shows as one digit or two, dd always shows two digits,ddd spells out three characters of the day,dddd spells out the day
mmm
mmmmmmm
Displays the month; m shows as one digit or two, mm always shows two digits,mmm spells out three characters of the month,mmmm spells out the month
yy or yyyy Displays the year as two or four digits
h or hh Displays the hour as one or two digits
n or nn Displays the minutes as one or two digits
s or ss Displays the seconds as one or two digits
AM/PM Displays the 12-hour clock value followed by AM or PM
More codes available – see Help
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-16
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Propagating Field Properties
Access displays the Property Update Options button whenever changes are made to an existing field
Click to display theUpdate Propertiesdialog box; then
choose the dependentobject(s)
(queries, forms, reports)to which this same change should be
applied
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-17
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Using Input Masks
To set a pattern for how data is to be enteredinto a desired field
Avoid conflict with the Format property
Partial list of Text field properties Enter input mask
OR
Click … to invoke the Input Mask Wizard
(only for Text or Date/Time fields)
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-18
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Commonly Used Input Mask Codes
Code Description
0 Required digit
9 Optional digit
# Digit, space, plus or minus symbol; if no data typed
L Required letter
? Optional letter
A Required letter or digit
a Optional letter or digit
& Required character or space
C Optional character or space
! Fill left to right, rather than right to left
\ Access is to display the character immediately following the \
More codes available – see Help
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-19
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Input Mask Examples
Input mask Entry Result
(000) 000-0000 2065550248 (206) 555-0248
(999) 999-9999 2065550248 (206) 555-0248
(000) AAA-AAAA 206555TELE (206) 555-TELE
#999-20 –20
2000 2000
>L????L?000L0greengr339m3 GREENGR339M3
may r 452b7 MAY R 452B7
>L0L 0L0 t2f8m4 T2F 8M4
00000-999998115 98115-
981153007 98115-3007
>L<??????????????maria Maria
brendan Brendan
SSN 000-00-0000 5555555555 SSN 555-55-5555
>LL00000-0000 db513920493 DB51392-0493
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-20
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
!\(999") "000\-0000;0;#
Creating an Input Mask…/2
Desired format\ displays next symbol
as a literal symbolEnclose spaces and other
text in quotation marks
0 - to store addedcharacters
1 or blank – do not store them
Placeholdercharacter
Sections of an Input Mask
Separate sections with semicolons
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-21
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Working with Memo Fields
Apply Rich Text Formatting * New in Access 2007- not available in earlier versions
Partial list of Memo field properties
Change to Rich Text and encodes all the field as HTML text
Change to Yes to allow only new data in the fieldWhen Yes, Access
maintains a history of added data
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-22
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Working with Memo Fields…/2
Rich Text Formatting Options
Available formatting options for data selected in a Memo
fieldFont Font
sizeDirectionL->R, R-
>L
Numbering &
Bullets
Unindent, Indent
Bold
Italic
UnderlineFont color
AlignmentHighlighte
r
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-23
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
Displaying History of Changes to a Memo Field
A Memo field’s Append Only property has been set to Yes; the field has been updated in a given record
Right-click the column entry in the desired record
Click Show column history…
History is removed when Append Only is reset to No
Review history and
click OK
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-24
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Creating an Attachment Field
New Data Type in Access 2007 - not available in earlier versions
Set Data Type to Attachment
Can store several files in a single field in a record
Each file may not be larger than 256
MB
Total size of all files may not exceed
2GB
Cannot change the data type
for an Attachment
field
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-25
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Attaching Files to Records
Double-click the paperclip
to open the Attachments dialog
box
Click Add, then navigate to desired files
and click Open
Datasheet View
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-26
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Editing an Attached File
Double-click the paperclip
to open the Attachments dialog
box
Double-click the desired file,
then edit and save it in its
source program
Datasheet View
Click OK when finished
Select a file, then click to
remove it as an attachment
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-27
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
How can you restrict the number of characters entered into a Text field?
Features Summary
In Table Design view, set the Field Size property
for the Text field
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-28
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
How do you change the column heading for a field in Datasheet view?
In Table Design view, set theCaption property
Features Summary
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-29
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
How do you disallow blank field values when entering data into a field?
Features Summary
In Table Design view, set theRequired property to Yes
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-30
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
How do you set up a field so that data entered is always capitalized?
Features Summary
In Table Design view, enter > in theInput mask property
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-31
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
How do you change the display of a Date field?
Features Summary
In Table Design view, set the
Format property to the desired format
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-32
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
How do you set placeholders for entering a Date field?
Features Summary
In Table Design view, set the
Input Mask property to the desired format
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-33
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
How do you define Rich Text Formatting for a Memo field?
Features Summary
In Table Design view, set the
Text Format property to Rich Text
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-34
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
What must you do to save a history of the changes to a Memo field?
Features Summary
In Table Design view, set the
Append Only property to Yes
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-35
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
How can you display the history of the changes to a Memo field?
Features Summary
Right-click the column entry in the desired record in Datasheet
view
Click Show column history…
Review history and
click OK
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-36
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1
How can you attach a file to a record?
Features Summary
1. In Table Design view, create an Attachment field, then
2. In Datasheet view, double-click the paperclip in the record to open the Attachments dialog box
Copyright 2007, Paradigm Publishing Inc.
BACK NEXT END
1-37
LINKS TOOBJECTIVES• Design Tables and
Fields• Data Types• Field Size Property• Field Properties• Custom Formats• Input Masks• Memo Field Rich
Text Format• History of Memo
Field Changes• Attachment Data
Type• Attaching Files to
Records• Features Summary
ACCESS 2007Chapter 1 Coming Next
DESIGNING AND BUILDING RELATIONSHIPS AND
LOOKUP FIELDS
Chapter 2Chapter 2
Recommended