OBJECTIVES Its our promise that by the end of this presentation, you will be able to: • Create and maintain an ACCESS table • Design a form • Develop a query • Create, format and print a report.
GETTING STARTED • Double click on your desk top icon or • Click Start, Programs, Microsoft Access.
<ul><li>Create a New Database </li></ul><ul><li>• Click Blank Access Database </li></ul><ul><li>• Click OK </li></ul><ul><li>• Save in: </li></ul><ul><li>- click the drop down arrow </li></ul><ul><li>click location to save database </li></ul><ul><li>• File name: type a file name for </li></ul><ul><li>the database. </li></ul><ul><li>• Click Create. </li></ul>
Open an Existing Database • Click Open an Existing Database • Select a file from list of files presented in the open window • Click OK
ACCESS DATABASE: Relational Databases. ACCESS is a relational database management system. Relational databases allow you to organize your data into tables; each table focuses on a specific topic; the various tables can then be linked to each other for inquiry and reporting purposes. Database Components. Microsoft Access uses four objects to create a Database: • Tables • Queries • Forms • Reports.
Table A table is the basic element of a Database and contains the data entered by users. Each row (or record) contains information about a particular item (e.g., an employee). The record is made up of several fields; each field contains one piece of information relating to the item (e.g., employee's name, address, phone, etc.). Query A query extracts selected data from a table (or another query) and presents it in spreadsheet format. Form A form is a graphical template based on a table (or query). It is used to enter new data into the database or display existing data. Report A report extracts selected data from a table (or query) and formats it for printing.
DATABASE WINDOW COMPONENTS Menu Bar Command Buttons Object Tabs Favorites
DATABASE WINDOW COMPONENTS Menu Bar This toolbar contains commands and submenus. They will change depending on the functions you are currently performing. Object Tabs Allow you to see a list of all objects in that category: Tables, Queries, Forms, Reports, Macros, and Modules. Command buttons you to Open an existing database, modify the Design of an existing database or create a New database. Groups A Group consists of shortcuts to the database objects that belong to it. You can keep related objects of different types together in a group. For example, you may group a Form together with its Subforms and the Tables and/or Queries that the Forms are based on. Favorites The Favorites folder stores shortcuts to frequently used file folders and databases.
TABLES Record (row) Field (column) Navigator Scroll Bars
<ul><li>Move to first record </li></ul><ul><li>Move back one record </li></ul><ul><li>Move forward one record </li></ul><ul><li>Move to last record </li></ul><ul><li>Move to new record </li></ul><ul><li>- Total number of records in the table </li></ul>
Movement Keys Tab, Enter – move you from field to field. Scroll bars (vertical, horizontal) – move up and down rows, through pages of records, or across several columns. Page Up and Down – move one page at a time. Ctrl/Home and Ctrl/End – move to the top or bottom of the table.
What is a Table? A table is a database object used to store, organize and view data. All other objects are based on the data stored in tables. Tables are comprised of: • Fields - represented by columns • Records - stored as rows. Tables look like EXCEL worksheets.
CHANGE COLUMN APPEARANCE Select a column with the down arrow:
CHANGE COLUMN APPEARANCE Resize • Position mouse cursor on the vertical line between column headings to display a cross • Drag left or right or • Double click on the vertical line to let Access choose the best column width. Select a Column • Place the mouse cursor in the heading of a column and click. Move • Click the mouse in the heading of a column.. • When the white arrow cursor is displayed, hold down the left mouse button. A small white box appears. • Drag this column to its new position.
Hide: • Click cursor in any row of column to be hidden. • Click Format. • Click Hide Columns. Show : • Click Format. • Choose Unhide Columns. • Click check box next to the column name to be shown. • Click Close. Freeze: keeps selected columns on the left side of the screen when you scroll to the right to see those fields which are not in view. • Position cursor in column to be frozen. • Click Format. • Click Freeze Columns. Note : the frozen columns are re-positioned to the left side of the screen. Unfreeze : • Click Format. • Click Unfreeze All Columns. Note : you may want to move the unfrozen columns to their original position.
ENTER, VIEW AND MODIFY DATA Undo Sort Find ENTERING DATA Enter Data • Type data and press Enter or Tab to move to the next cell. VIEW DATA Find Data • Click the Find icon to locate a particular field value in the table. • The Find and Replace dialog box allows you to search for all or part of a field in one or many columns. Sorting • Select a column and click the ascending or descending sort icon. The sort applies to the display; the physically stored data remains unchanged on the table.
<ul><li>MODIFY DATA </li></ul><ul><li>Edit Undo </li></ul><ul><li>• Undo the last change by clicking Undo on the toolbar; you can undo the last saved record by selecting Undo Saved Record from the Edit Menu. </li></ul><ul><li>Esc (keyboard key) </li></ul><ul><li>• Undo all changes to this record as long as you are still in edit mode. </li></ul><ul><li>Pencil on the left side of the record indicates edit mode (as opposed to view mode). </li></ul><ul><li>Replace Data </li></ul><ul><li>• On the Edit Menu, click Replace. </li></ul><ul><li>• In the Find What box, type the value you want to find. </li></ul><ul><li>• In the Replace With box, type the value you want to replace it with. </li></ul>
TABLE DESIGN Tables are the heart of a database. If tables are organized efficiently, query and report design will be straightforward. Design a Table • Click Table Tab • Click New • Click Design View and OK. Categorize Your Data Each table should deal with one category of data and have a unique key to which all the other fields are related. Normalize Your Data Data normalization increases the accuracy of your data and saves space on your database by eliminating duplicate information where it is not necessary. • Eliminate redundancy – data values should not be repeated in several records of a table and records should not have empty fields. • Define smallest components – break your data into distinct components; e.g., Last Name, First Name, Street, ZIP, Area Code, etc. Choose a Primary Key A Primary Key is a field that uniquely identifies each record in the table; all data in the table should be related to that unique key.
DATA TYPE DEFINITIONS Text • any character (alpha, special characters, numbers) • up to 255 in length • numbers cannot be used for calculations Memo • any character (alpha, special characters, numbers) • up to 65,000 in length • numbers cannot be used for calculations • field cannot be sorted or indexed Number • numeric data to be used for mathematical calculations • not to be used for currency fields • Field Size property further defines its function and size Date/ time • must be a valid date/time entry at entry time • format property determines display format
Currency • prevents rounding off during calculations • 15 digits to the left of the decimal point and 4 to the right are available Auto Number • ACCESS automatically creates an incrementing unique number • controlled by ACCESS • cannot repeat Note: since an Auto number field value is unique within each table, it can be used as a Primary key if none of the other application fields contain unique values. Yes/No • logical indicator (one of two values) • on/off, true/false, yes/no • Yes value is yes, on, true or -1; No value is no, off, false or 0 . OLE object • used to store Word or Excel documents • can also store pictures, sound and graphics created by other programs
FIELD PROPERTIES The properties for each field in your table are displayed in the Field Properties pane in Design View. ACCESS assigns default values for all properties that you can change. • Click a field in the Design view window • Press F6 to jump to the related Field Properties display. Field Size :- Sets a maximum size for data; varies according to Data Type: • text is 255 characters • number - byte (255) - integer (+/- 32,000, no fractions) - long integer (+/- 2 billion, no fractions) - single (floating point, decimal precision 7) - double floating point, (decimal precision 15)
Format Date/time, currency, and numbers have several display formats available. Click on the down-arrow to the right of the format cell to see options. Input Mask Controls the way data is entered; frequently used for telephone numbers, postal codes, SSN #’s, date/time fields. ACCESS offers a Wizard for text and date/time data types. Caption You specify text for the label attached to a field; will be used as the column heading when displaying tables, queries and reports. The default value is Field Name. Default Value Specifies a value that will be automatically entered when you create a new record. Validation Rule Controls the values to be entered into a field; e.g., < 1/1/2000 Validation Text The message that will be displayed when the rule is broken; e.g., “Cannot enter dates later than 12/31/1999”.
Required Click Yes to indicate that data must be entered into the field. Allow Zero Length Applies to text, memo and Hyperlink only. Entering a zero length string (“”) means, “I know there is no value for this field”; used with Required property. Indexed An index helps ACCESS find and sort records faster; use on fields you search frequently, or fields you intend to join in queries. Indexes can be based on a single field or multiple fields; the field value does not have to be unique; e.g., LastName. • Click the Indexed property in Field Properties. • Click the drop down list arrow for options. • Click an option: - No to remove an existing index - Yes (Duplicates OK) for non-unique indexing or - Yes (No Duplicates) for unique indexing.
TABLE RELATIONSHIPS View related tables in Datasheet view. Sub datasheet Orders Order Details
Fields from distinct tables can be merged on queries and reports
TABLE RELATIONSHIPS Viewing multiple tables in the same window in Datasheet view Open multiple tables in Datasheet View: • From Database Window, click a table and click Open • Click a second table, click Open • Click Window on Menu Action Bar • Click Tile Vertically Sub datasheet Access 2000 has a new feature which allows you to show a related table by clicking on the small + in each row in datasheet view. The related table will be displayed as a Sub datasheet (and the small + is now a -). Each Table has a Unique Focus Each table focuses on one topic; the topic is usually defined by the Primary Key – e.g., Order ID. Tables are related by common fields For Query and Reporting purposes, tables can be joined so that all detail information can be displayed (see Orders and Order Details Report on opposite page). Example The Orders Table lists : • Order numbers • Customer numbers. Customer details are carried in the Customers Table and Product descriptions are carried in the Products Table.
HELP FROM THE WEB • Click Help in the Menu Bar. • Click Office on the Web to access the Internet and open the Microsoft Office Update web page. • Click: - Access Favorites (click on a topic) - Under Access, click "Assistance".
<ul><li>What is a Form? </li></ul><ul><li>A Form is a database object used for data entry, update and display. A Form displays only one Table record at a time whereas a Table Datasheet shows multiple records at one time. You can design a user-friendly template (form) for data entry and update, which focuses on one specific record, or one set of joined records from multiple tables. </li></ul><ul><li>Sections There are three Form sections: </li></ul><ul><li>Form header Appears at the top of the page. This section displays a title for a form, instructions for using it and command buttons that open related forms or carry out other tasks. </li></ul><ul><li>Detail Displays records. You can display one or many records on a screen. </li></ul><ul><li>Form footer Appears at the bottom of every page. This section is used to display instructions, command buttons, or unbound controls to accept input. </li></ul><ul><li>Controls Each section contains controls; controls are objects on a form that display data, perform actions or decorate the form. They are created through icons on the toolbox in Design View. </li></ul><ul><li>Controls may be bound, unbound or calculated: </li></ul><ul><li>• bound controls are tied to a field in an underlying table or query. </li></ul><ul><li>• unbound controls do not have a data source; they display static information (labels, headings) or pictures. </li></ul><ul><li>• calculated controls use expressions as the source of data. </li></ul>
FORM WIZARD The quickest way to create a Form is to use the AutoForm Wizard. Even if you want a customized Form, you may want to start with AutoForm and then modify it. Using Form Wizard From Database window: • Click Table Tab and select a Table • Click Open • Click New Object: AutoForm icon in Table Datasheet Toolbar OR Form Wizard Menu • Click Forms Tab • Click New • Click Form Wizard • Select a Table or Query from the drop-down list (OK) • Follow prompts: - select Fields (Next) - select Layout (Next) - select Style (Next) - create a Title (Finish).
Modify a Form for the following reasons : • data fields need to be relocated in order to fit on one screen • font size should be enlarged for easy reading • cosmetic purposes, e.g., adding a logo or enhancing appearance with color. Design View A form has three sections : Form Header, Detail, Form Footer. Toolbars Display three toolbars to modify a Form: Form Design, Formatting Form/Report and Toolbox To display toolbars: • Click the Forms Tab • Click Design • Click View in the Menu bar • Click toolbars • Click the desired Toolbar. FORMATTING TOOLBAR ICONS from Design View, click on the background section of the Form or a particular control on the form to select it for modification. Palettes There are 3 Color palettes available in the Formatting toolbar: • Fill/Back color - paint background colors in forms, labels and textboxes • Font/Fore Color - change text color • Line/Border Color - change line color, e.g., borderlines.
Line/Border/ Width Adjusts the thickness of lines . Special Effects Applies to label boxes and text boxes; boxes can be flat, raised, sunken, etched, shadowed, chiseled. Text formatting Standard font, intensity and alignment tools; apply these to text in label and text boxes. TOOLBOX TOOLBAR ICONS Add label Add a label to the form: • click the icon • click the area where you want to insert the box • hold down the mouse button and draw (drag) a square big enough to hold the box • release the mouse button • type text.
Unbound object frame Add an unbound picture to the form: • click the icon • click the area where you want to insert the object • hold down the mouse button and draw a square big enough to store the picture • release the mouse button (Insert Object window appears) • choose from a list of object types such as Clip Art, Gallery, Paintbrush picture, etc. Object frame properties Size Mode Property: default is Clip; you can change to Stretch. • Right click on picture • Left click on Properties - Clip – If the picture cannot fit into the space allowed for it, it is clipped to fit. - Stretch – The picture is sized to fit the space allowed, keeping its height/width ratio.
SELECTION QUERIES A selection query searches for data that meet your selection specifications and creates a Record set containing all the records that qualify. You can view this Recordset on your screen or use it as the source for a Report. When designing a query manually you can specify: • table(s) from which you want to extract data • fields you want displayed • calculations you want performed on those displayed fields • ranges of data • sort sequences for various fields. Query Design: • click the Query Tab • click New • click Design View • click OK.
Choose Source for Query Fields: The Query Design window and a pop-up Show Table window listing all the tables and queries in your database are displayed. As you choose a table and/or query for your source, the selected object will be placed into the top pane of the Query window. • Click an object in the Show Table (table or query) • Click Add • Repeat these two steps for each object that is needed • Click Close. Select Fields: • Double click each field in the source object that you want to include in your query. The selected fields will be placed into the Field portion of the Design grid. OR Drag and drop each field from the source object into a cell in the Design grid. • Specify selection criteria (see next page) and/or sort sequence for each of the selected fields.
COMMON EXPRESSIONS Criteria Expression Shows records where France Value is France Not France Value is not France In (France, Germany, Italy) Value is France, Germany, or Italy <M Value begins with letters A-L >=M Value begins with letters M-Z 100 Numeric value is 100 <=20 Numeric value is less than or equal to 20 Date() Date is today’s date Now Current date and time >=#1/1/98# Date is on or after 1/1/98 Between #1/1/98#AND#12/31/98# Date is in the year 1998 2/*/* Date is in the month of February Null The field does not contain a value Is Not Null The field contains a value Note : when using a date in a calculation, surround it with number signs (#).
SUMMATION QUERIES Click on Totals icon Totals row RUN
SUMMATION QUERIES Queries provide either detail information or summation information about the data in your Tables. For example • Detail – Display information from an individual table row. • Summary – Show a count of the number of checks written to a particular Payee To obtain totals or “grouped by” category information, you must add the TOTALS row to your Query design grid: • Click the Totals button on the toolbar. • The Totals Row is displayed underneath the Table row on your design grid and the phrase “Group By” appears in the Total cell for each Field. • You have several options for calculations: Sum, Average, Count, Last, etc. In the example on the opposite page, Access will group expenses together by “Pay To”, show the First check number paid in each group, and also count the number of checks written in each “Pay To” category.
FILTERS: Filter by Selection Based on a Table: Select value to be used as criterion. Filtered data
Filter by Form Based on a Query: Enter selection criteria Filtered data
What is a Filter? Filters act like Queries; they allow you to select and view data records quickly. A filter differs from a query in the following ways: a) entire records are reviewed, not just specified fields b) multiple tables cannot be accessed in a filter c) calculations cannot be performed in a filter d) the filter tool can be selected from table datasheet view, query view or form view. Applying a Filter There are two ways to filter: Filter by Selection – specify one criterion by clicking on a value you are looking for within a datasheet or form: • open a table • click on a specific value in any field on the table • click on the Filter by Selection icon in the toolbar • Access will display all rows having the same value as the field you selected. Filter by Form – specify both criteria and conditions in a blank version of your table . • open a table • click on the Filter by Form icon in the toolbar • key in selection values or conditions in any field (s) OR click the drop down list arrow in any field and click a specific value in the list • Access will display all rows having the same value(s).
What is a Report? A Report is used to display and print selected information from a Table or Query. Reports can display detail information as well as sub-totals and grand totals; queries can display either details or totals. A Report has several sections: • Report header Appears once at the beginning of a report; it is printed on the first page, before the page header. • Report footer Appears once at the end of the report; it is printed on the last page, before the page footer. • Page header Appears at the top of every page. • Page footer Appears at the bottom of every page. • Group header Appears at the beginning of a new group of records. • Group footer Appears at the end of a group of records. • Detail Contains the main body of a report’s data; controls in this section repeat for each record of the database.
Controls Each section contains controls; controls are objects on a form that display data, perform actions or decorate the form; they are accessible through the toolbox in Design View. Controls may be bound, unbound or calculated: • bound controls are tied to a field in an underlying table or query • unbound controls do not have a data source; they display fixed data (information, lines, pictures) • calculated controls use expressions as the source of data.
REPORT WIZARDS The quickest way to create a report is to use the AutoReport Wizard. Even if you want a customized Report, you may want to start with one of the Report Wizard formats and then modify the layout. Using the Report Wizard From Database window: • Click Reports Tab • Click New • Select Report Wizard from list (OK) • Follow prompts: - choose a Table or Query (OK) - select fields (Next) - select grouping * levels (Next) - specify sorting sequence (Next) - select layout and orientation (Next) - click Finish. * Grouping levels: allow you to keep together data belonging to a specific group; e.g., all customers with the same Zip code.
CHART WIZARD Charts and graphs can be created using Report Wizard. Access offers a variety of chart styles: • bar charts • pie charts • line charts • area charts • 3-D charts. Using the Chart Wizard From Database window: • Click Reports Tab • Click New • Select Chart Wizard from list (OK) • Follow prompts: - choose a Table or Query (OK) - select fields (Next) - select type of chart (Next) - specify layout (e.g., x and y axis fields) (Next) - specify a title for the chart (Finish).
VIEWING THE REPORT Preview the report in design view: • Click down arrow on the View icon • Print Preview shows the entire report; you must use the scroll bars to view left and right and page down. • Layout Preview shows one sample page, displaying the various sections. From Report View (or Print Preview), you can use the Page buttons to see one, two or multiple pages at once; the Zoom button allows you to enlarge and view any section in order to read it. Print Report To print a Report: • click the Reports tab • click the report you want to print • click the Printer icon Note: Always preview your Report before printing.
CLOSING ACCESS Object Window Close Button Access Application Close Button
A particular slide catching your eye?
Clipping is a handy way to collect important slides you want to go back to later.