Access Intermediate

Similar documents
Access Intermediate

Access Intermediate

MIS 2502 Access 2007 Tutorial

The specific steps to build Wooden Crafts database are here: 1. Create New Database. i. After opening Access, click Blank Desktop Database :

Level 6 Relational Database Unit 3 Relational Database Development Environment National Council for Vocational Awards C30147 RELATIONAL DATABASE

Getting started with Ms Access Getting Started. Primary Key Composite Key Foreign Key

Exploring Microsoft Office Access Chapter 2: Relational Databases and Multi-Table Queries

Microsoft. Student Edition. The Richard Stockton College of New Jersey. Computer Courseware

Microsoft Access 2010

Access Intermediate

Database Design Practice Test JPSFBLA

Introduction to Microsoft Office Access 2010

Very Short Answer Type Questions [1 Mark each]

Microsoft Access 2010

Word Module 5: Creating and Formatting Tables

Introduction to Microsoft Access 2016

Copyright 2009 Labyrinth Learning Not for Sale or Classroom Use LESSON 1. Designing a Relational Database

Microsoft Certified Application Specialist Exam Objectives Map

Microsoft Access 2007 Module 1

INTRODUCTION ACCESS 2010

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Microsoft Access: Let s create the tblperson. Today we are going to use advanced properties for the table fields and use a Query.

By: Access 2007 Table

COMM335 Summer 2016 (Tutorial 1) (1) Creating Tables in a Database

Table of Contents COURSE OVERVIEW... 5

Microsoft Access Basics

Using Microsoft Excel

Objective 1: Familiarize yourself with basic database terms and definitions. Objective 2: Familiarize yourself with the Access environment.

ACCESS 2007 FOUNDATION

Complete Quick Reference Summary

Office Access. Intermediate

Microsoft Access 2013

Microsoft Access 2013

INTRODUCING. Access. R. Kumar

Database Concepts Using Microsoft Access

SOFTWARE SKILLS BUILDERS

MS-Access : Objective Questions (MCQs) Set 1

Index. B backing up 76 7

Chapter11 practice file folder. For more information, see Download the practice files in this book s Introduction.

Microsoft Access Description

Intermediate Microsoft Access 2010

Microsoft Access 2010 For the End User. 9/12/2011 Archdiocese of Chicago Mike Riley

UNIT 2 Designing and Managing Database Objects. Each of the following statements is either true or false. Indicate your choice by circling T or F.

Nutzen Sie die Dettmer-Seminarunterlagen für Access bei einmaligem Kauf über Jahre hinaus für Ihre eigenen Schulungen

ACCESS. Laboratory Manual. Çankaya University Department of Computer Engineering

COMM 391. Objectives. Introduction to Microsoft Access. What is in an Access database file? Introduction to Microsoft Access 2010

Rev. C 11/09/2010 Downers Grove Public Library Page 1 of 41

Introduction to Computer Applications. CISY 1225 Chapter 10. Zahoor Khan, PhD

Work with Tables and Database Records

MICROSOFT ACCESS VERSION 2010 FOUNDATION

Tutorial 5 Advanced Queries and Enhancing Table Design

Administering a Database System

Microsoft Access 2010 Beginning Written By: Jeff Hutchinson

Course: US02EBCA02 (Working with RDBMS for Small Scale Organizations) Effective from June

Full file at

Simple Invoicing Desktop Database with MS Access 2013/2016. David W. Gerbing School of Business Administration Portland State University

MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.

Page 1 of 7. First tutorial: Second tutorial:

Microsoft Access 2010

Microsoft Access 2007 Tutorial. Creating a Database using Access 2007

Adding records Pasting records Deleting records Sorting records Filtering records Inserting and deleting columns Calculated columns Working with the

Designer TM for Microsoft Access

Microsoft Access: Table Properites, Complex Forms. Start with a new, blank Access database,

Microsoft Office Access 2013: Part 01. Lesson 01 - Getting Started with Access

MODULE III: NAVIGATING AND FORMULAS

Tutorial 2. Building a Database and Defining Table Relationships

MS Components: Quick Start

Database Use & Design

Access 2007: Basic Instructor s Edition

Using Microsoft Excel

Microsoft Access XP (2002) Queries

Rev. B 12/16/2015 Downers Grove Public Library Page 1 of 40

Microsoft Office 2010: Introductory Q&As Access Chapter 3

SEE GRADING CRITERIA AT THE BOTTOM. Database Tables Lookup Wizard Relationships Forms Queries Reports

Contents. Creating Forms

Study Guide. PCIC 3 B2 GS3- Key Applications-Excel. Copyright 2010 Teknimedia Corporation

Customization Manager

Microsoft Office Specialist Access 2016

Access 2016 Foundation. North American Edition SAMPLE

Formulas, LookUp Tables and PivotTables Prepared for Aero Controlex

Schnieder_index.qxd 7/27/05 1:08 PM Page 481 INDEX. Symbols

MS Excel Henrico County Public Library. I. Tour of the Excel Window

Access 2016 Foundation SAMPLE

Using Microsoft Access

Creating Reports in Access 2007 Table of Contents GUIDE TO DESIGNING REPORTS... 3 DECIDE HOW TO LAY OUT YOUR REPORT... 3 MAKE A SKETCH OF YOUR

Tutorial 1: Introduction to Microsoft (MS) Access. Microsoft Access: A Relational Database Application

Preview. MS Access Tutorial. Data Files Available on

Instructions for Using the Databases

Computer Skills MS Access Work Sheet # 1

As your databases continue to evolve, you will need to incorporate advanced queries and reports. This chapter addresses how to create and use action

MS Excel Henrico County Public Library. I. Tour of the Excel Window

Excel 2013 for Beginners

Delphi for Windows. Inside this manual

CHAPTER 6 SUMMARY. Objective 1: Identify Good Database Design

MOODLE MANUAL TABLE OF CONTENTS

Copyright 2018 MakeUseOf. All Rights Reserved.

Access Review. 4. Save the table by clicking the Save icon in the Quick Access Toolbar or by pulling

Follow these steps to get started: o Launch MS Access from your start menu. The MS Access startup panel is displayed:

ADD AND NAME WORKSHEETS

Introduction to RefWorks

Transcription:

Access 2010 - Intermediate (103-134) Building Access Databases Notes Quick Links Building Databases Pages AC52 AC56 AC91 AC93 Building Access Tables Pages AC59 AC67 Field Types Pages AC54 AC56 AC267 AC270 Field Size Page AC55 Caption Pages AC56 AC 204 Field Descriptions Page AC61 Default Value Page AC103 Validation Rule Pages AC264 AC265 Validation Text Pages AC264 AC265 Table Validation Pages AC266 AC267 Required Pages Allow Zero Length Pages Indexed Pages Masks Pages AC258 AC262 Mask Characters Page AC260 Lookups Another Table Pages AC254 AC257 Lookups Static List Pages AC282 Limit to List Pages Primary Keys Pages AC5 AC52 AC53 AC66 AC67 Defining Table Relationships Pages AC91 AC96 Resolving Relationship Errors Pages (none) Activity This icon designates a video is available as an additional reference. Video DVD is available in the Stevens Point library 1

Notes Building Access Databases Databases are built one table at a time Tables are then linked, relationships are defined Build tables that are exclusively parent tables first; then build tables that are mixed, sometimes parents, sometimes children; finally build tables that are exclusively children. This ensures lookup tables are available where needed. Lookup tables are used to define what values are acceptable for a field. Normally used for linking fields (foreign keys). Ensures data exists in parent table before record in child table. Simplifies data entry for users. Linking data (Customer ID, Course ID, etc.) becomes invisible. Ensures data accuracy. User doesn t type data, selects from a list. Activity Building Access Tables Building an Access table involves: Assigning field names To better allow integration with other programs, I recommend NOT using spaces in your field names (include them in the caption if you wish) Assigning field types (see below) Specifying default values Specifying data validation rules Defining input masks Defining formats Defining lookup links Defining primary key(s) 2

Notes Field Types Activity Access 2: Guidelines for Setting Field Properties Text Most common field type Maximum 255 characters Size property should be specified Memo Text field, max 65,535 characters Text Format Rich Text allows user to format the data they enter Number Size property should be specified to designate accuracy of number (see below) Date/Time Enter dates with slashes or dashes 1- or 2-digit months and days 2- or 4-digit years If 2-digit year <30=2000 else 1900 If leave year off, get current year Enter times with hours and minutes (and optional seconds) separated by : Add a or p after time for am or pm Currency Special version of number Accurately stores 15 digits left, 4 digits right of decimal point 8 bytes Includes $ commas and 2 decimal places Format customizable Autonumber Field value automatically incremented by Access when new record added Usually used for numbers or IDs: Customer Number, Order Number, Member ID etc. If records are deleted values do not renumber! Deleted number is simply no longer used. Yes/No Appears as a check box in Datasheet View and forms (though you can change that) Can also be treated as True/False 3

Notes Attachment Create attachments to the record (pictures, video, files, etc.) Each record can have multiple attachments without having multiple attachment fields Access displays and attachment icon in the field. Double-click the icon to open the Attachments dialog box. Click Add to open the browse dialog and locate the file to attach CAUTION: the attachment is actually copied into the database. Large attachments can make your database very large. Alternatively, consider simply storing the file location in the database. To view attachments to a record Double-click the attachment icon Select the attachment from the dialog box Click the Open button OLE Object Include Microsoft Office document parts Hyperlink Store web addresses and Email addresses Access automatically launches the web site or email program when these data items are clicked. Activity 4

Field Descriptions Field Size Access allows you to enter a more detailed description of the field s purpose This helps others (or you) who may need to update the table s structure in the future. Tip: A more practical use of the field description is to provide tips on how or what type of data to enter in the field. The text entered in the field description displays in the status bar whenever the insertion point is in the field. The book s suggestion to enter Primary Key or Foreign Key is pretty much useless. These terms don t mean much to the average person entering data into the table, though they can be meaningful to someone modifying the database structure. Tip: the descriptions won t show up in the status bar until you close the table and open it back up again. Switching from design view to datasheet view is not good enough close the table. Fields of different types have different properties. The following are descriptions of the most commonly used properties for the most common types of fields. Text Specifies the maximum number of characters allowed in the field. Number Byte Values 0-255 Storage: 1 byte Integer Values ±32K Storage: 2 bytes Long Values ±2.1G Storage: 4 bytes Single 7 digits accuracy Storage: 4 bytes Double 15 digits accur. Storage: 8 bytes Decimal 28 digits accur. Storage: 12 bytes Add descriptions (help) for each field below. Define field size for various Student Table text fields. Define field size for Course Section credits earned field 5

Caption (all field types) Defines the text that appears as column headings in Datasheet View. Field names and captions can be different. Also used as label for field when using the Form & Report wizards. Caption is optional; if omitted, field name used as caption. Default Value (all field types) Value that is automatically entered into a field for the user (Datasheet or Form View) Can be replaced. When entering data, default value is highlighted. Press Enter to accept Type any other value to replace Define caption for at least FName and LName fields. Set default value for State to WI Set default value for Credits to 3 Can be calculated (Date() ) (Use the Builder ) Validation Rule Access 5: Defining Data Validation Rules Define rules (value ranges) data must follow to be acceptable. Use = > < >= <= <>, in, between, and, or, wildcard Set validation rule for credits between 1 and 10 Specify validation text for above. Validation Text Text that appears if data doesn t meet validation rules. Error message appears in dialog box Our standards dictate that any field with a validation rule must include validation text. 6

Table Validation Required Access also allows you to define table validation that does what are normally called consistency checks Consistency checks compare the values of two or more fields to ensure they are consistent that they do not contradict each other In the Table Tools Design ribbon, Show/Hide group, click the Property Sheet button to display the table s Property Sheet (dialog box) Alternatively, you can right-click an empty area in the design window and choose Properties from the popup menu Designate the consistency check validation in the Validation Rule box Tip: Click the build button at the right end of the box to open the Expression Builder to help you create the validation rule Be sure to enter validation text (the error message) as well. If you need to check more than one pair of fields, use an AND in the validation rule and specify the second condition. I don t recommend using required except for primary keys (which Access does automatically) Forces user (data entry person) to enter a value in this field. If value is unknown, can enter generic value or record can not be entered. I allow user to decide what is required. However, database specifications may require data entry. Allow Zero Length Provides some restrictions on how field can be left blank Rarely used See Help (search for field properties) 7

Indexed Indexing is another term for sorting Access can keep numerous lists of record numbers (indexes) that describe different ways for sorting the same records. Primary keys automatically indexed, no duplicates Because of the speed of today s processors and Access sorting capability in Datasheet View, I don t normally generate indexes other than those for the key. If you do set up indexes, normally, duplicates are allowed (except for key fields). Indexes automatically update when records are added or deleted. Input Masks Masks force users to enter data in a certain format. For instance a part number might be made up of 3 letters followed by 5 digits. Masks would keep users from inadvertently entering characters where digits should be and vise versa. Masks can also be used to simplify data entry by automatically entering characters that always appear in the same place. For example, the dash in an 8-character phone number always appears in the fourth position. Masks allow Access to automatically insert the dash so the user doesn t have to type it. Access includes a Mask Wizard that automates the entry of some common masks (phone numbers, social security numbers, zip codes, etc. Click the Build button ( ) next to the Input Mask box to access the wizard. Note: you can add your own commonly used masks to the masks included in the wizard. Often, you ll have to create your own, custom masks. Enter masks for State >LL Zip: 00000;;# Phone: (999) 000-0000 8

Masks are composed of three parts: The mask itself, with special mask characters (see below) A save literals code. Literals are fixed characters in a mask; the characters that never change, like the dash in a phone number. You can have Access save these characters or simply insert them when the values are displayed. If you don t save the literals, you can save a lot of storage space in large databases. However, you have to remember that the values don t contain literals when you do searches and specify query parameters. Generally, don t save the literals. Code: 0 save the literals 1 don t save the literals (default) Fill character Fill characters are often referred to as place holders. Access displays the fill character to show the user where characters should be typed in the mask. Usually, the fill character is a # or and underscore (_) (default). These three parts are entered one after the other, separated by semicolons. 9

Mask Characters Masks use special codes to designate what type of character can be placed in which positions. Character Type Required Optional Digit 0 9 Digit or Space # Letter (A-z) L? Letter or Digit A a Any character & C The following characters are recognized where appropriate (phone numbers, dates, times, etc.)., : ; - / ( ) The following characters have the designated effect: > - Convert all following characters to uppercase < - Convert all following characters to lowercase! - Fill field right to left (very confusing to use) \ - Remove special meaning from any above character (convert to literal) Password: If you literally enter the word password into the mask property, Access will create a password field whose characters are hidden (*****). Mask Notes Mask characters are case sensitive I generally don t use masks with numeric or date fields If you use a mask for one character of a field you must provide a mask for every character in the field. Ex: If you try to automatically capitalize the first character of field using the >C< mask, you will restrict the size of the field to one character. You must specify a mask for every character in the field: >C<CCCCCCCCCCCC (one C for every character allowed) There is no way to create a mask that automatically capitalizes the first letter of every word in a field. This can only be accomplished using programming. 10

The Fill right to left character (!) is a little tricky. It allows the user to enter partial values into a field and aligns those values to the right instead of to the left. For instance the user could enter the 7 digits of a phone number, leaving off the area code. Access would place the number right aligned in the field. Users have to be taught how to use these fields because the text is still entered left to right, but Access automatically right aligns the data when the user leaves the field. Don t use required mask characters on the right side of the field. Access will require the user to enter data in those positions. For example, the mask for a phone number (that comes with MS Access) is incorrect. mask:!(999) 000-0000 If the user enters 3423121 for the phone number, it would look like this on the screen: (342) 312-1### The user has left off 3 required digits at the end of the field and Access complains. If you want the field to have at least 7 digits, put the required digits at the beginning of the field instead of the end: corrected mask:!(000) 000-0999 This looks like the area code is required, but actually, 7 digits are required. After the user leaves the field, the phone number is properly aligned to the right in the mask. 11

Lookups Masks can be propagated, meaning applied to all usages of the field in the database. For example, if you apply a mask to a phone number field and propagate the mask, it will also be applied to any query, form or report that uses that phone number field. You can selectively propagate (just one form for example) To propagate a mask: Manually edit the mask Unfortunately, the Property Update Options button doesn t appear if you use the mask wizard. Press tab to leave the Mask property. The Property Update Options button will appear. Click the button to display the available options and select the first option (Update Input Mask wherever ) An Update Properties dialog box will appear listing all the objects (forms, reports) that use this field. Select the objects you want to propagate to and click the Yes button. Access 5: Creating a Lookup Field Access allows you to provide a list of values the user can choose from to fill in a field. You can look up these values from a fixed list of options, or look them up using the values in another table or query. You can force the user to choose from the list or allow the user to enter a value that is not on the list. 12

Lookups from Another Table/Query This type of lookup is generally used to find the value of a linking field from a child table back to the parent table. Enter the field s name For the field type, choose the Lookup Wizard Select the first option (look up in a table or query) Select which table or query to look up from (see tip below) Select the linking field (must be included in lookup) Select the fields needed to facilitate the lookup Ex. You d typically use the customer s name to lookup a customer s ID Size the columns to show all data. The book likes to display the ID (linking field) in the lookup as well as the lookup value. I disagree. Most IDs mean nothing to users. I always hide them. If you used a query, completely shrink the linking field to hide it. Specify a label for the field. I try to specify a generic label rather than a specific one: E.g. Customer instead of CustomerName or CustomerID. Again, I differ from the book here. Create a query and lookup field to link Instructor to Course Section (parent) Do others as time allows or as needed. From now on, whenever this field is displayed (forms, Datasheet View), Access will automatically do the lookup and display the contents of the first (visible) field you selected above. Tip: I almost always create a query to be used exclusively for each lookup field. By doing this, I can completely control what data appears in the lookup and what order it appears in. I frequently concatenate numerous fields to form one in the lookup table. If you don t do this, Access displays the lookup table in primary key order (which is almost never what you want) and only shows the first field in the results. Note: The parent table must exist before you can create a lookup to it. 13

Lookups from a Static List In addition to looking up values from an existing table you can type in a fixed list of values for the user to choose from. Specify the field name and select Lookup Wizard for the field type. Choose the I will type the values I want option Specify the number of columns in your lookup table (usually one) In the lookup table, type the values you want, capitalized as you want, in the order you want. Press Tab after every item in the list, not Enter. Specify a (generic) label for the field. Limit To List After you ve generated your lookup field, you might want to specify whether the user can type additional values that are not on the list. With the lookup field selected, click the Lookup tab in the properties pane. Generate a static list of acceptable grades Ensure all lookups Limit to List properties are set to Yes Note: The lookup wizard has filled in most of the properties for you. Set the Limit to List property to the value you want. Yes forces the user to select from the list (default) No allows the user to enter values not on the list Tip: double-click to easily alternate the value. Other Lookup Considerations If your static lookup list is very long or isn t very static (changes frequently) consider creating a special table solely for the lookup values. This will allow you to easily change values. Lookup lists effectively hide the existence of linking fields from the user. Some people might consider this hiding a bad thing, but from my experience, users don t miss knowing how tables are connected. 14

Defining Primary Keys Access 2: Specifying the Primary Key Each table must have at least one primary key Primary keys usually listed first To define primary key: Select the field (place cursor anywhere in row) Click the Primary Key button on the toolbar or Right-click the field Choose Primary Key To define combination keys (multi-field keys): Select all the rows for the key fields Right-click or click Primary Key toolbar button Defining Table Relationships Access 2: Defining Table Relationships Most databases contain more than one table (sometimes hundreds or thousands) All of the tables are typically related to at least one other table in the database, sometimes more. Most relationships are one-to-many relationships which means that one record in the parent table is related to many records in the child table. One student takes many classes (student is parent, class is child) One customer places many orders (customer is parent, order is child) One order contains many line items (order is parent, line item is child) Note a table can be a parent in one relationship and a child in another (order) In order for two tables to be related they must share one field. Normally, that field is the primary key field from the parent table. The fields must be of exactly the same type, though they could have different names. Normally, the linking field (aka foreign key) is named the same in both the parent and child table for clarity. 15

Access can figure some relationships out by itself, but it is best to define the table relationships yourself. Tip: Close all open tabs before defining relationships. To designate the relationship between two tables Link the tables according the ERD Click the Relationships button in the Relationships group of the Database Tools tab Note this button is also available in the Table Tools Design tab The Show Table dialog box will appear. Select the tables to relate (probably all of them) Double-click the table name to quickly include the table in the Relationships window. Close the Show Table dialog box. Tip: If you forget a table, you can open the Show Table dialog box again by selecting the Show Table button in the Relationships group of the Relationship Tools Design tab. For each pair of tables that are related, drag the common field in the first table to the second table. It doesn t matter if you drag from the parent to the child or child to the parent. Note that Access figures out which table is the parent table (1) and which is the child ( ) 16

The Edit Relationships dialog box appears. We want to make sure that every record in the child table has a corresponding record in the parent table (no orphan records) Check the Enforce Referential Integrity option (that s what referential integrity means no orphan records) We also want to make sure if we change the linking field value in the parent table, all the child record s linking field values are automatically updated. Click the Cascade Update Related Fields check box Finally, we DO NOT want child records to be automatically deleted when we delete the parent record. Automatically deleting records is generally a bad idea. You should take steps to ensure the child records don t become orphaned. Do NOT check the Cascade Delete Related Records check box If you delete a parent record, the child records will be orphaned. To prevent this, manually delete (or modify) all child records linked to the parent to be deleted before deleting the parent record. Tip: To modify a relationship, double-click the relationship line. The Edit Relationships dialog box will reappear. Try it. Tip: To delete a relationship (rarely needed), single click the connecting line (it will turn darker) and press the Delete key on the keyboard. Tip: It is normally best to define these relationships before entering data into tables. However, for your assignments, you ll be entering some data manually and importing other data before creating the relationships. If an error occurs (see below), the error is always in one of the primary keys or linking fields that you entered manually (the book data is accurate) 17

Check the data you entered manually closely and make the necessary corrections. Try linking the tables again. In real world databases, finding the linking errors may not be so easy. Use a Find Unmatched Query described on pages AC247 AC249 Improving the Relationships window appearance Access places the tables into the window in the order they are added. Often you will need to rearrange the tables to improve the appearance and clarity of the relationships. To move a table in the Relationships window, point to the table s title bar and drag it to a new location. Use your ERD as a guide. 18