McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved. 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 Field Property Primary Key Graphic Column Width
McGraw-Hill Technology Education © 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 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 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 Outline continued Exiting Access Key Terms FAQs Discussion Questions
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 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 Corel Paradox Lotus Approach
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved The Access Window Getting started task pane Workspace Mouse Pointer Menu bar Title bar Database toolbar
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Creating a New Database Plan Design Develop Implement Review
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Concept 1 Database Database – Organized collection of related information Table – Vertical columns & horizontal rows where information is stored Record –A row –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. DATABASE Database Management Systems DBMS (Database Manager, relational Tables)
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 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 Default name is selected Places bar Restricts to database files Default location
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Concept 2 Object Use TableStores data QueryFinds and displays selected data FormView, add, and update data in tables ReportAnalyzes and prints data in a specific layout
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 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 Three Ways to Create a Table 1.Datasheet View 2.Design View 3.Table Wizard
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 Primary Key Field Names Field Properties Data Type Description Table Design View
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Concept 3 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 Field Name Check page 12 (design view buttons)
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Defining Field Names Click to open drop-down list Help information on data types Default data type Field name
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Defining Data Types Default data type Data types
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved HW Please download the new homework from my website ://hani/hani
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Concept 4 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 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 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. 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.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Concept 5 Characteristic that defines a field Each data type has a set of properties Enhances the way table works Field Property
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Field Properties Field Size Format Input Mask Caption Default Value Validation Rule Validation Text Required Allow Zero Length Indexed
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Properties (1 of 2) Field size Number of character Format ‘ ’ lower and upper case in text Input Mask You can use the InputMask property to make data entry easier and to control the values (000) Caption Specifies a field label other than the field name Default Value Specifies a String value that is automatically entered in a field when a new record is created Validation Rule (student file) M or F in gender Validation Text You must specify M or F
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 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 Concept 6 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 Primary Key One example of a field that should not used as the primary key is ………. Field.
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 Defining Date Format Date/time data type formats Format name Format sample
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Defining Additional Fields 11 fields defined
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 ENTERING AND EDITING TABLE DATA Views ViewPurpose Design viewUsed to create a table, form, query, or report Datasheet viewProvides a row-and-column view of data Form viewDisplays records in a form PreviewDisplays data as it will appear when printed
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Using Table Datasheet View Datasheet Field selector Record selector Current record Record number indicator Navigation button Datasheet containing one blank record Record number indicator Table datasheet toolbar
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Entering Data in a Datasheet View Informs you that entry is not valid Identifies end of table or where new record can be entered or edited
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 Concept 7 Clipart We are pleased to announce the grand opening of Tom’s Deli Drawing Object Photograph Graphic
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 Inserting a Picture Create a new object Insert existing object
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Preview Changes dialog box view Preview of selected file
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Opening Inserted Object Picture opened in graphics program
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Navigating a Datasheet KeyVoiceMovement Right arrow key or Tab Tab or RightNext field Left arrow key or Shift +Tab Shift tab or leftPrevious field Downward arrow key DownCurrent field in next record Upward arrow key UpCurrent field in previous field Home First field in record End Last field in record
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 Concept 8 Size of a field column Affects amount of data you can see Default can display characters Can adjust width for appearance Use Best Fit: automatically adjusts the column widths of all selected columns to accommodate the longest entry. Column Width
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Resizing a Column Drag to size column width Column width increased and field entries are fully displayed
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Using Best Fit All fields selected
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 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 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 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 Previewing the Table 1-inch margin Page number in footer Mouse pointer Table name and date Print Preview toolbar
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved More on Preview Displays two pages
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Changing the Page Orientation Page orientation changed to landscape
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Print Options OptionAction AllPrints the entire document PagesPrints pages you specify by typing page numbers in the textbox Selected RecordsPrints selected records only
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Printing a Selected page Enter page numbers to print Selected printer
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 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 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 Opening a Database Access file names Student names document
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Opening a Table Table name selected Open selected table object
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 Key Terms active window Best Fit bound object cell clip art column width current field current record database Database toolbar drawing object datasheet data type field field name field property
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Key Terms continued field selector field size graphic landscape navigation buttons object orientation picture portrait primary key record record number indicator record selector relational database table
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved Key Terms continued Unbound object view Wizard workspace
McGraw-Hill Technology Education © 2004 by the McGraw-Hill Companies, Inc. All rights reserved 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 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 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 MM- DD-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 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 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?