* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download 1 of 2 - Faculty Personal Homepage
Survey
Document related concepts
Transcript
Office Access 2003 Lab 1 Creating a Database McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-2 Objectives 1. Plan and create a database. 2. Create and save a table structure. 3. Define field names, data types, field properties, and primary key. 4. Change views. McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-3 Objectives continued 6. Enter and edit data in Datasheet view and Data Entry. 7. Insert a picture. 8. Adjust column widths. 9. Use the Best fit feature. McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-4 Objectives continued 10. Add records. 11. Delete records. 12. Preview and print a table. 13. Close and open a table and database. McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-5 Concept Preview • • • • Database Object Field Name Data Type McGraw-Hill Technology Education • • • • Field Property Primary Key Graphic Column Width © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-6 Outline • Introducing Access 2003 – Starting Access – Exploring the Access Window • Creating a New Database – Planning and Designing a Database – Creating and Naming the Database McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-7 Outline continued • Creating a Table – Defining Field Names – Defining Data Types – Defining Field Properties – Entering a Field Description McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-8 Outline continued • Creating a Table continued – Defining a Primary Key Field – Defining Date formats – Defining Additional Fields – Editing Field Definitions – Saving the Table Structure McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-9 Outline continued • Entering and Editing Table Data – Using Table Datasheet View – Entering Data in a Datasheet View – Editing Data – Inserting a Picture – Navigating a Datasheet McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-10 Outline continued • Changing a Column Width – Resizing a Column – Using Best Fit • Adding Records in Data Entry • Deleting Records McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-11 Outline continued • Previewing and Printing a Table – Previewing the Table – Changing the Page Orientation – Printing a Selected Page • Closing and Opening a Table and Database McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-12 Outline continued • • • • Exiting Access Key Terms FAQs Discussion Questions McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-13 Introducing Access 2003 • Starting Access – New file task pane is displayed – Start by first creating a new database or opening an existing one • The Access Window features – Database toolbar – Taskpane – Workspace – Status bar McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-14 DBMS • Three most widely used database programs – Microsoft Access – Corel Paradox – Lotus Approach McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-15 Lotus Approach Corel Paradox Try to read about these applications McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-16 The Access Window Title bar Menu bar Getting started task pane Database toolbar Mouse Pointer Workspace McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-17 Creating a New Database • • • • • Plan Design Develop Implement Review McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-18 Concept 1 Database Database Management Systems DBMS (Database Manager, relational Tables) • Database – Organized collection of related information • Table – Vertical columns & horizontal rows where information is stored • Record – A row DATABASE – Information about one person, place, or thing • Field – A column – Smallest unit of information - Access database can contain multiple tables that can be linked to produce combined output from all tables. - This type of database is called relational database. McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-19 Planning and Designing a Database • Analyze current record-keeping system • What forms are currently used for data entry? • What reports are needed? • What data will be in the tables? • How will the tables be related? McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-20 Creating and Naming the Database File • File New Database dialog box – Database file name • Default is db1 • Extension is .mdb • Replace with new name – Location of file • Default is My Documents folder • Database window – Opens in workspace – Name of database displayed in title bar McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Creating and Naming the Database Places bar Default location Default name is selected McGraw-Hill Technology Education Restricts to database files © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-21 1-22 Concept 2 Object Object Use Table Stores data Query Finds and displays selected data Form View, add, and update data in tables Report Analyzes and prints data in a specific layout McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-23 Database Objects • There are seven main components of a database in MS Access: • Tables. Use tables to store database information. Table is the heart of the Database, since it contains the actual data and all other objects are base on the Table. We use Tables to store all the data in the database. Each row of the table contains one Record. Records are made up of Fields that contain a particular piece of data in the table • Forms. Use forms to enter or edit the information in your tables. Forms let you view one record at a time. Easier to access and use when entering or modifying Data than a Table • Reports. Use reports to deliver a professional presentation or written report to your class. • Queries. Filter data so that you retrieve selected records or fields from the database. • Pages. Create HTML pages from a database quickly and efficiently. • Macros. Automate tasks that you perform on a regular basis in a database.Changes Modules. Automate a group of related procedures in Access 2000. McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-24 Creating a Table • The table object is the basic unit of a database • Must be created first before other objects • Cannot open more than one database file at a time McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-25 Three Ways to Create a Table 1. 2. 3. McGraw-Hill Technology Education Datasheet View Design View Table Wizard © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-26 Design View Table Design Toolbar Two open windows Field definition grid used to define fields McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-27 Table Design View Primary Key Field Names Data Type Field Properties Description McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-28 Concept 3 Field Name • Used to identify data stored in the field • Up to 64 characters long • Cannot start name with a space • Examples: – Last name – First name – Address Check page 12 (design view buttons) McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-29 Defining Field Names Click to open drop-down list Field name Default data type Help information on data types McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-30 Defining Data Types Default data type Data types McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-31 Concept 4 Data Type • Data type defines the type of data field will contain. • Used to ensure right kind of data is entered • Important to choose appropriate data type McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Data Types Text (words, combination of words and numbers, numbers that are not used in calculation, names and phone numbers) up to 255 Memo Text that is too long to be stored in a text field, up to 65536 Number Used when you want to perform calculations on the values in the field. Date/Time Currency AutoNumber Sequential number that is automatically incremented by one when ever a new record is added to a table. Use patient file McGraw-Hill Technology Education Yes/No Accepts only yes or no, T or F, • OLE Object An object (such as a Microsoft Excel spreadsheet, a Microsoft Word document, graphics, sounds, or other binary data) inked to or embedded in a Microsoft Access table. - insert object options • Hyperlink Accepts hyperlink entries that are paths to an object. The easiest way to insert a hyperlink address in a field or control is to click Hyperlink on the Insert menu. • Lookup Wizard • Creates a field that allows you to choose a value from another table or from a list of values by using a list box . • HW © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-32 1-33 Concept 5 Field Property • Characteristic that defines a field • Each data type has a set of properties • Enhances the way table works McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-34 Field Properties • • • • • Field Size Format Input Mask Caption Default Value McGraw-Hill Technology Education • • • • • Validation Rule Validation Text Required Allow Zero Length Indexed © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. Properties (1 of 2) 1-35 • Default Value • Field size Specifies a String value that is automatically entered in Number of character a field when a new record is created • Format ‘<‘ , ‘>’ lower and upper case in text • Validation Rule • Input Mask (student file) M or F in gender You can use the InputMask property to make data entry easier and to control the values (000) 000-0000 • Caption • Validation Text • You must specify M or F Specifies a field label other than the field name McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-36 Properties (2 of 2) • Required Rejects any record that does not have a value entered for this field. (put required field= yes) • Allow Zero Length Allows text or memo strings of zero length (“ ”),null • Indexed Increase the efficiency of a search on the designated field • Unicode Compression To store the data more efficiency , set to “yes” McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-37 Entering a Field Description Field description Help information on current task McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-38 Concept 6 Primary Key • • • • • • A field that uniquely identifies each record Most tables have a primary key Key data MUST be unique Prevents duplicate records Used to control sorting order Used to create a link between tables One example of a field that should not used as the primary key is the name Field. McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-39 Defining a Primary Key Defines field as primary key Indicates field as primary key Duplicate values in field not allowed McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-40 Defining Date Format Date/time data type formats Format sample Format name McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-41 Defining Additional Fields 11 fields defined McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-42 More on Creating Tables • Editing field definitions • Saving the table structure McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-43 ENTERING AND EDITING TABLE DATA Views View Design view Datasheet view Form view Preview McGraw-Hill Technology Education Purpose Used to create a table, form, query, or report Provides a row-and-column view of data Displays records in a form Displays data as it will appear when printed © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-44 Using Table Datasheet View • • • • • Datasheet Field selector Record selector Current record Record number indicator • Navigation button McGraw-Hill Technology Education Table datasheet toolbar Datasheet containing one blank record Record number indicator © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-45 Entering Data in a Datasheet View Identifies end of table or where new record can be entered or edited Informs you that entry is not valid McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-46 Datasheet View • Entering data – Should be accurate and consistent – Typed exactly as you want it to appear • Editing data – Position insertion point in field – Use ESC to cancel changes McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-47 Concept 7 Graphic We are pleased to announce the grand opening of Tom’s Deli Photograph Drawing Object Clipart McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-48 Graphics • Graphic: is anon text element or object such as a drawing. • Drawing object: consisting of shapes such as lines and boxes • Picture: is an illustration such as a scanned photograph • Bound object: is stored in a table and connected to specific record and field. • Unbound object: is associated with the table as a whole , not with the specific record. McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-49 Inserting a Picture Create a new object Insert existing object McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-50 Preview Changes dialog box view Preview of selected file McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-51 Opening Inserted Object Picture opened in graphics program McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-52 Navigating a Datasheet Key Voice Movement Right arrow key or Tab Left arrow key or Shift +Tab Tab or Right Next field Downward arrow key Upward arrow key Down Home Home First field in record End End Last field in record McGraw-Hill Technology Education Shift tab or left Previous field Up Current field in next record Current field in previous field © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-53 Changing a Column Width Column width too small to display entire entry Column width larger than needs to be McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-54 Concept 8 Column Width • • • • • Size of a field column Affects amount of data you can see Default can display 15.6667 characters Can adjust width for appearance Use Best Fit: automatically adjusts the column widths of all selected columns to accommodate the longest entry. McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-55 Resizing a Column Column width increased and field entries are fully displayed McGraw-Hill Technology Education Drag to size column width © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-56 Using Best Fit All fields selected McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-57 Adding Records in Data Entry All existing records are hidden Number of records entered in data entry McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-58 Adding Records in Data Entry Records are displayed in primary key order McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-59 Deleting Records Deletes selected record Message box asks you to confirm deletion McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-60 Previewing And Printing A Table • Preview table to save time – Adjust magnification to best fit – Can view multiple pages • Page orientation – Portrait – Landscape • Print table – Use default settings – Use Print command to change settings McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-61 Previewing the Table Print Preview toolbar Table name and date 1-inch margin Mouse pointer Page number in footer McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-62 More on Preview Displays two pages McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-63 Changing the Page Orientation Page orientation changed to landscape McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-64 Print Options Option Action All Prints the entire document Pages Prints pages you specify by typing page numbers in the textbox Selected Records Prints selected records only McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-65 Printing a Selected page Selected printer Enter page numbers to print McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-66 Closing And Opening A Table & Database • • • • Close table and save any layout changes Close database Click OPEN to open existing database file Select name of table to open McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-67 Closing a Table Table name appears in the table object list McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-68 Closing the Database Main menu and toolbar buttons are available Empty Access window McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-69 Opening a Database Student names document Access file names McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-70 Opening a Table Open selected table object Table name selected McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-71 Exiting Access • Click X in the upper right corner of the Access window • Menu equivalent is File/Exit McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-72 • Quiz 3: Access Chapter 1 • Next Saturday McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-73 Key Terms • • • • • • • • active window Best Fit bound object cell clip art column width current field current record McGraw-Hill Technology Education • • • • • • • • database Database toolbar drawing object datasheet data type field field name field property © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-74 Key Terms continued • • • • • • • • field selector field size graphic landscape navigation buttons object orientation picture McGraw-Hill Technology Education • • • • portrait primary key record record number indicator • record selector • relational database • table © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-75 Key Terms continued • Unbound object • view McGraw-Hill Technology Education • Wizard • workspace © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-76 FAQs 1. What is a relational database? 2. What is the difference between a table and a file? 3. Does a database contain one table or several tables? McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-77 FAQs 4. The My Document folder has several files called db1, db2, db3, etc. What are these? 5. What other Access objects are in a database besides tables? 6. What is a primary key? 7. I am ready to enter my data into Access. What do I need to do first? McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-78 FAQs 8. How can I get the state code of my state to be entered automatically in a field? 9. I want to enter dates using the MMDD-YY format. Is there an easy way to do this? 10. I forgot a field in my table and now I want it positioned in the middle of the table. How can I do this? McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-79 Discussion Questions 1. Discuss several uses you may have for a relational database. Explain the steps you would follow to create your first table. 2. Discuss why it is important to plan a database before creating it. How can proper planning save you time later? 3. Discuss the difference between Edit mode and Navigation mode. McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 1-80 Discussion Questions 4. Design view and Datasheet view are two views in Access. Discuss when it would be appropriate to use each of these views. 5. Discuss why it is important to choose the correct data type for a field. What may happen to the data if you change the data type? McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved.