Access 2000: Module I © 2001 ComputerPREP, Inc. All rights reserved. Lesson 1: Designing Databases © 2001 ComputerPREP, Inc. All rights reserved. Objectives • Identify database components • Design data tables • Design relational databases Identifying Database Components • Database – an organized collection of information • Table – a collection of data organized into rows and columns • Field – a category of information in a table • Record – a collection of information, consisting of one or more related fields, about a specific entity, such as a person, product or event • Query – a specialized instruction that displays or performs an action on specific information from a data table Identifying Database Components (cont’d) • Form – a database object used to view, enter, edit and manipulate data • Report – a database object used to summarize and print information from data tables or queries Designing Data Tables • Determine what fields you will use to store your data • Store data in the smallest fields possible • Build in flexibility in the design stage Designing Relational Databases • Relational database – a database that contains multiple tables related through common fields • Relationship – a connection between two or more tables based on common fields • When designing a relational database, consider: – The purpose of the database – The number of tables needed to store information without duplicating data – The fields needed in each table – The fields common to more than one table Lesson 2: Examining Access Objects © 2001 ComputerPREP, Inc. All rights reserved. Objectives • • • • • • • • Start Access and open a database Explore the database window Examine tables Examine queries Examine forms Examine reports Use the Office Assistant Exit Access Starting Access and Opening a Database • Open a database: – Using the Startup dialog box – Directly from the Access window • Use the Startup dialog box to: – Create a new database – Create a database modeled after a built-in database template – Open an existing database Exploring the Database Window • Use the database window to create, edit and delete database objects • The database window contains: – The object bar – the vertical bar in the left pane of the database window that you use to select the type of database object with which you want to work – The object list – a list of all objects of the type specified in the object bar contained in the open database, and shortcuts for creating new objects Examining Tables • Datasheet view – the open view for a table in which you examine or work with the data • Design view – the view in which you work with the layout and design of the database object itself • In Datasheet view: – Each row designates a record and each column designates a field – You can navigate through records by clicking in a field, by pressing keyboard directional keys, by clicking a navigation button, or by typing a number in the Record number box and pressing Enter Examining Queries • You can use queries to selectively view and analyze data • The two types of queries are: – Action query – performs an action on specified records in a data table – Select query – displays specific information from a data table Examining Forms • You can use a form to enter data into a table or to display table records one at a time • The open view for a form is Form view • Form view includes a Record number box and navigation buttons Examining Reports • You can use reports to summarize and print data from data tables • The open view for a report is Print Preview • Print Preview includes navigation buttons and a Page number box for navigating through report pages Using the Office Assistant • The Office Assistant suggests help topics related to tasks you are currently performing and tips on using features more efficiently • You can: – Specify to enable or disable the Office Assistant – Change the graphic that represents the Office Assistant • The Office Assistant is a shared feature among all Office 2000 applications; changes you make to it in one application apply to the other applications Exiting Access • To exit Access: – Close any open database object – Click the Close button in the database window title bar to close the current database – Click the Close button in the Access window title bar to exit the application Lesson 3: Creating Databases and Tables © 2001 ComputerPREP, Inc. All rights reserved. Objectives • Create new databases • Create tables Creating New Databases • You can create two types of databases: – Blank database – contains no database objects and displays an empty database window – Template-based database – generated by a wizard and is data-ready • It is often easier, faster and less frustrating to start with a blank database and to create database objects as needed Creating Tables • You can create tables using the table design window or a table wizard • A table is defined by its fields and attributes you assign – the field name and data type – Field name – a field attribute that uniquely identifies each field in a table – Data type – a field attribute that determines the type of information a field can contain Creating Tables (cont’d) • To create a table using the table design window: – Display the Tables object list, then click the New button – In the New Table dialog box, double-click Design View – Specify field names and data types – Assign a primary key • Primary key – a field containing a value that uniquely identifies each record in a table Creating Tables (cont’d) • To create a table using the Table Wizard: – Display the Tables object list, then double-click Create table by using wizard – Follow the prompts in each wizard screen Lesson 4: Working with Records © 2001 ComputerPREP, Inc. All rights reserved. Objectives • • • • • Modify datasheet layout Add records Edit records Delete records Sort records Modifying Datasheet Layout • When you modify datasheet layout, you temporarily affect the way data is displayed; the structure of the table does not change • You can use column and record selectors to modify datasheet layout – Column selectors – the gray areas at the top of a datasheet in which field names display – Record selectors – the gray areas at the left border of the datasheet in which the record indicator displays for the current record Modifying Datasheet Layout (cont’d) • To modify datasheet layout: – Change column widths – drag the border between column selectors or double-click a border between column selectors – Move columns – click a column selector, then drag to a new location in the datasheet – Hide columns – right-click a column selector, then click Hide Columns – Show columns – right-click a blank area of the datasheet window, click Unhide Columns, then turn the check box for the hidden column Adding Records • To add a new record: – Click the New Record button in the navigation buttons or in the toolbar – Type data into each field, pressing ENTER to move from field to field Editing Records • To edit a record: – Double-click in a field, retype the entry, then press ENTER or – Click once in a field and selectively edit portions of the data Deleting Records • You can delete a single record or several at a time • Deleting a record is a permanent action • To delete a record: – Click the record selector for the record – Click the Delete button in the toolbar – Confirm the deletion Sorting Records • You can sort records to display them in order by the values in any field • You can sort records by the values in a single field or in multiple adjacent fields • When you sort by multiple fields, the field furthest to the left serves as the primary sort field; the next field to the right is the secondary sort field, and so on • Sorting records does not change the physical order of the records in the table Lesson 5: Working with Table Structure © 2001 ComputerPREP, Inc. All rights reserved. Objectives • Modify table design • Set field properties Modifying Table Design • You change the table design in table design view • When you make changes in table structure, you work with field selectors – Field selectors – the gray areas to the left of the Field Name column in the table design window • To modify table design: – Add a field – type the field data in the next available row of the table design window or use the Insert command to add a field at a specific position in the table Modifying Table Design (cont’d) • To modify table design (cont’d): – Delete a field – right-click the field selector for the field and click Delete Rows – Move a field – click the field selector for the field and drag it to a new position in the table design window – Rename a field – select the field name in the table design window, type a new name, then save the table – Use Name AutoCorrect – a feature that ensures table field references in all associated database objects are automatically updated whenever you rename a field Setting Field Properties • Field properties – settings that determine how data is stored, handled and displayed in tables, forms and reports • Two ways you can set field properties are: – Limiting field size – controlling the maximum number of characters that can be stored in a Text field or controlling the range of values that can be stored in a Number field – Setting field formats – controlling format features, such as case or decimal places Lesson 6: Locating Information © 2001 ComputerPREP, Inc. All rights reserved. Objectives • Find records • Understand comparison operators • Use filters Finding Records • You can use the Find feature to locate records that contain a specific value or text string in a particular field • You specify a Match value to control how Access evaluates each record • Searches begin from the current record down and loop back to the beginning of the datasheet Understanding Comparison Operators • Queries and filters use criteria to test records and determine whether or not they should be displayed • To define criteria, you can create expressions that use comparison operators – Criteria – conditions that records must meet to pass through a filter or to be selected by a query – Comparison operator – a character, such as > or =, used to compare two values or expressions Understanding Comparison Operators (cont’d) Operator Meaning Example = Equals =“ENG312” <> Not equal to <>”ENG312” > Greater than >96 < Less than <96 >= Greater than or equal to >=65 <= Less than or equal to <=65 Between Between two values (inclusive) Between 85 and 95 In In a set or list of values In(“Smith”, “Summers”) Is Null Field is empty Is null Is Not Null Field is not empty Is not null Using Filters • Filter – a set of criteria that is applied to an open table to isolate a subset of records • You can create four types of filters: – Filter by Selection – click a field containing the value to be used as the criteria and only records that match the value in the same field are displayed – Filter Excluding Selection – click a field containing the value to be used as the criteria and only records that do not match the value in the same field are displayed Using Filters (cont’d) – Filter by Form – enter filter criteria into the Filter by Form window – Filter for Input – right-click a field and type a value or expression into the Filter For text box on the shortcut menu to specify criteria Lesson 7: Using Select Queries © 2001 ComputerPREP, Inc. All rights reserved. Objectives • • • • Create select queries Apply filters to query result sets Modify query design Work with criteria Creating Select Queries • Result set – the collection of records selected and displayed by a query • The three basic steps for creating a query are: – Specify the table or tables from which the query will select data – Define which table fields will be included in the query – Specify which fields to display or hide and in what order the records in the result set will display Creating Select Queries (cont’d) • You can create select queries: – From scratch in query design view – By using the query wizard • When you create a select query in query design view, you work in the Select Query design window, which displays: – The table or tables you add to the query display – The field list – a list of all the fields in an underlying table or query – The query design grid – the pane in which you add fields to display in the query. You use the design grid to specify criteria and to control the display of the result set Applying Filters to Query Result Sets • You can apply filters to query result sets the same way you apply them to tables • Applying a filter to a query result set displays a subset of the result set • You apply filters to query result sets in the query’s open view, not in query design view Modifying Query Design • To modify query design, you can: – Add fields – new fields are added to the right of the existing columns in the design grid – Delete fields – any data currently in the fields is also removed – Insert fields – you can insert fields at any position in the design grid – Move fields – you can move field columns by dragging the column’s selector to a different position Modifying Query Design (cont’d) – Set field properties – each query field has a set of properties stored in a Properties sheet • Caption property – displays text other than the field name in the field selector • Format property – controls the display of data in the result set Working with Criteria • Use criteria to limit the records displayed in the result set • You can specify one criterion or multiple criteria • When you specify multiple criteria, you enter criteria for two or more field columns Working with Criteria (cont’d) • Use expressions and logical operators to set criteria – Expression – any combination of comparison operators, values or field names that defines the limiting conditions a record must meet – Logical operators – “And” and “Or” determine whether a query result set must satisfy all or any of the multiple query criteria Lesson 8: Creating and Using Forms © 2001 ComputerPREP, Inc. All rights reserved. Objectives • • • • • • • • Create forms using AutoForm Create forms using the Form Wizard Work with controls Work with control properties Work with form properties Create forms using Design view Add records using forms Print forms Creating Forms Using AutoForm • AutoForm – automatically creates a form that displays all fields and records from a single table or query, using a pre-defined layout • AutoForm layout options: – Columnar – displays each record’s data vertically; each field of each record appears on a separate line and only one record displays at a time – Tabular – displays each record’s data horizontally; each field appears in a column and several records can display at once – Datasheet – displays the records in Datasheet view Creating Forms Using the Form Wizard • The Form Wizard presents a series of dialog boxes that guide you step by step through the creation of a new form • You can specify: – The table or query to use as a data source – The fields to include on the form – A pre-defined style – To base the form on more than one table or query Working with Controls • Control – a graphic object in a Form or Report window • The three kinds of controls used in a form are: – Bound control – displays data from the form’s underlying table or query; bound controls update to reflect changes in the data source – Unbound control – a control that is not tied to fields in an underlying table or query, such as labels, text boxes, option buttons, command buttons and lines – Calculated control – calculates values in a form, such as totals or averages Working with Controls (cont’d) • To delete a control: – Select a control and press the DELETE key • To add a control: – Drag a field from the field list into the form design window to add a bound control – Click a control tool in the Toolbox and click and drag in the form design window to add an unbound control • To move a control: – Select the control, place the mouse pointer on any control border (not on a sizing handle), and drag to a new location Working with Controls (cont’d) • To size a control: – Select the control and then click and drag one of its sizing handles • To align controls: – Select the controls to be aligned, then choose an alignment command from the Format menu • You can align an individual control, a group of adjacent controls or a group of non-adjacent controls Working with Control Properties • Every control has a set of properties stored in a Properties sheet that you can modify • Different types of controls have different properties. For example, label controls have a: – Caption property – determines what text displays in a label control – Control Source property – determines which table or query field is displayed in the control Working with Form Properties • Forms have their own distinct set of properties that control the way they function and display – Caption property – controls the text that displays in the title bar of the form window – Record Source property – determines which table or query will be used as the underlying source for the bound controls in the form Creating Forms Using Design View • You can create a form from scratch in Design view • To create a form using Design view: – Start with an empty form – Add controls – Specify form properties Adding Records Using Forms To use a form to add a record: • Display the form in Form view • Click the New Record button in the navigation buttons • Type entries into each field, pressing ENTER to move from field to field Printing Forms • You can print forms in: – Form view – Design view – Datasheet view • When you print forms, you can specify to print: – The currently selected record – All records Lesson 9: Creating and Using Reports © 2001 ComputerPREP, Inc. All rights reserved. Objectives • • • • • • • Create reports using AutoReport Work with report sections Work with controls Work with control properties Work with report properties Create reports using Design view Print reports Creating Reports Using AutoReport • AutoReport – automatically creates a report that displays all fields and records from a single table or query • AutoReport layout options: – Columnar – displays each record’s data vertically; each field of each record appears on a single line – Tabular – displays each record’s data horizontally; each field appears in a column Working with Report Sections • In Design view, a report displays with several sections: Section Description Report header Contains the text that appears at the top of the first page Page header Contains the text that appears at the top of every page Group header Identifies each grouping of records in a report Group footer Displays numeric summaries for each group of records Detail section Contains the fields displayed for each record Page footer Contains the text that appears at the bottom of every page Report footer Contains the text that appears at the bottom of the last page Working with Controls • You can add, delete, select, move, size and align controls within sections of a report • You can group and sort records in the detail section of a report • To move a control: – Select the control, place the mouse pointer on any control border (not on a sizing handle), then drag to a new location • To size a control: – Select the control, then click and drag one of its sizing handles Working with Controls (cont’d) • To group fields in a report: – Display the report in Design view – Click the Sorting and Grouping button – Select the fields by which to group records • To sort records in a report: – Group the fields whose records you want to sort – Specify whether to sort the records in ascending or descending order Working with Control Properties • Every control has a set of properties stored in a Properties sheet that you can modify • Different types of controls have different properties – Label controls have a Caption property, which determines what text displays in the control – Bound text box controls have several format properties that affect the data they display Working with Report Properties • Reports have their own distinct set of properties that control the manner in which they display and print – Caption property – controls the text that displays in the title bar of the Print Preview window – Page Header and Page Footer properties – determine whether or not page headers and footers will print on all pages or only some pages – Record Source property – specifies the table or query used as the underlying source for the bound controls in the report Creating Reports Using Design View • You can create a report from scratch in Design view • To create a report using Design view: – Start with an empty report – Add controls – Specify report properties Printing Reports • To see what a report will look like when printed, you can view it in Print Preview or Layout Preview • You can print reports in: – Layout Preview – Print Preview – Design view • You can use the Page card of the Page Setup dialog box to change the page orientation – Portrait – the page is taller than it is wide – Landscape – the page is wider than it is tall Lesson 10: Enhancing Forms and Reports © 2001 ComputerPREP, Inc. All rights reserved. Objectives • • • • Format with AutoFormat Change the appearance of forms and reports Use form sections Add graphics Formatting with AutoFormat • AutoFormat – formats a form or report with a predefined format or layout • AutoFormat applies the formatting to the entire form or report • You can make additional changes to the applied format Changing the Appearance of Forms and Reports • You can customize a form or report by applying special effects and other formatting • Special effects make a control appear to be: – Flat – Raised – Sunken – Shadowed – Chiseled – Etched Changing the Appearance of Forms and Reports (cont’d) • You can also apply colors to forms and reports • You can apply color to: – Backgrounds – Controls – Text Using Form Sections • When you create a form using AutoForm or the Form Wizard, the form header and form footer sections are created, but remain closed and empty • You can expand the form header and form footer section and add controls, lines, graphics and colors Adding Graphics • You can add graphics to forms and reports, including lines and shapes, clip art, image files created in other programs and Microsoft Excel charts or graphs To draw a line or a rectangle: – Click the Line tool or Rectangle tool in the Toolbox, then click and drag in the Design window To add a graphic image: – Click the Image tool in the Toolbox, click and drag in the Design window, navigate to the location of the image, then double-click the file name