Access2007 m2
Upcoming SlideShare
Loading in...5
×
 

Access2007 m2

on

  • 584 views

 

Statistics

Views

Total Views
584
Views on SlideShare
552
Embed Views
32

Actions

Likes
0
Downloads
3
Comments
0

1 Embed 32

http://jigeno.wordpress.com 32

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Access2007 m2 Access2007 m2 Document Transcript

  • Microsoft Access 2007 Module 2 http://pds.hccfl.edu/pds
  • Microsoft Access 2007: Module 2 August 2007©2007 Hillsborough Community College - Professional Development and Web Services
  • Hillsborough Community College - Professional Development and Web ServicesThe material contained in this training material is copyrighted ©2007 HillsboroughCommunity College Department of Professional Development and Web Services andmay not be reproduced without express, written permission. Other trademarks, tradenames, logos, designs, brand names, and product services mentioned in this publica-tion may be trademarks or registered trademarks of third parties.
  • Microsoft Access 2007 - Module IITable of Contents Objectives. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 Import a Table from Excel. . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Export an Access Table to Excel. . . . . . . . . . . . . . . . . . . . . . . 5 Create a Query . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Query Sort. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 . Show. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 Text Data Criteria . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 Wildcards. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 Field Not in Result. . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 Number. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 Comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 Comparison And. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 Comparison Or. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 Aggregate Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 . Count . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 Avg (Average). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 . Parameters and the Between Operator. . . . . . . . . . . . . . . . . 21 Report Wizard . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 Modify a Report. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 Insert Images into a Form or Report. . . . . . . . . . . . . . . . . . 26 . Resize Images in a Form or Report. . . . . . . . . . . . . . . . . . . . 27 i
  • Microsoft Access 2007 - Module IIObjectives At the end of this training session you will be able to: 1. Import a table from Excel; 2. Export an Access table to Excel; 3. Create a query; 4. Sort fields in a query; 5. Show fields in a query; 6. Run a query using wildcards; 7. Run a query for fields not in result; 8. Run a query for a number value; 9. Run a query using the comparison criteria “And”; 10. Run a query using the comparison criteria “Or”; 11. Understand the purpose of Aggregate Functions; 12. Create and run a query using count; 13. Create and run a query using average; 14. Create and run a query using the parameter between; 15. Insert and resize a graphic/image; 16. Create and Modify a Report. 
  • Hillsborough Community College - Professional Development and Web Services
  • Microsoft Access 2007 - Module IIImport a Table From Excel Access and Excel work well together. It isquite simple to import data from an alreadyexisting Excel spreadsheet.In this example, we are using the files 1located on your computer’s desktop, in thePDWS folder. 1. Open this module’s Access 2007 file. 3 e.g. Desktop > PDWS folder >Access > Access II > Access2007_M2.accdb Under the External Data tab>Import group, 2 click on Excel. 2. After the Get External Data dialog box appears, click on Import the source data into a new table in the current database. Other options are to append the new records to a table or link the Excel spreadsheet to the Access database. If you choose to append the records 6 to a table, make sure the fields and data types match with the existing data. 5 3. Click on the Browse button and select the file to import. e.g. Desktop > PDWS folder >Access > Access II > Employee_Add.xlsx 4. Click OK. 5. Select which worksheet or range to import by clicking on the Show Worksheets or Show Named Ranges radio button. e.g. Show Worksheets 7 6. Select the sheet or sheet range to import and click on Next. e.g. Sheet1 7. Add a check mark by clicking on the First Row Contains Column Headings and click on Next. Adding this check mark specifies that the first row contains a column heading. 
  • Hillsborough Community College - Professional Development and Web Services 8. You can specify information about the spreadsheet fields on this screen, such as data type. You can even specify if you do not want to import a certain field. These specifications are 8 set in the Field Options area. In this example, we are going to import all fields. 9. Click Next. 10. Choose the appropriate primary key setting and click on Next. 9 In this example the ID is the primary key; however, Access can choose a primary key. Also you can choose a primary key or choose not to have any primary key. Select Choose my own primary key and ID from the drop-down list. 10 11. Type a name for the table and click on Finish. e.g. tblEmployeeAddresses 12. If you will be importing a file repeatedly, Access gives you an option to save the import steps. For this example, do not check to Save import steps and click on the Close button. 13. tblEmployeeAddresses now appears in the left pane, under Tables. 11 13 12
  • Microsoft Access 2007 - Module IIExport an Access Table toExcelAny database table can be exported, in a 2variety of formats. In this example, we aregoing to export to Excel. 1. In the Navigation Pane, select the object to 1 export, e.g. tblEmpInfo 2. In the External Data tab>Export group, select Excel. 3. Click the Browse button to select a destination 3 for the exported file. 4. Select an appropriate file format. If you need 4 to share this file with people that do not have Excel 2007, choose Microsoft Excel 97-2003. If that is not a concern, select Excel Workbook. 5 5. Specify the appropriate export options. Add a checkmark to Export data with formatting 6 and layout. You can also select the option Open the destination file after the export operation is complete, if you would like to 7 preview the exported file. 6. Click on OK. 7. If you elected to Open the destination file after the export operation is complete, Excel will open with the new exported file displayed. 8. Save the export steps, if this is a regularly occurring export and click Close. 8 
  • Hillsborough Community College - Professional Development and Web ServicesCreate a Query A query allows for table inquiries. A querycan change, delete, add, and arrange 1data in tables. Queries also aid gatheringinformation for forms and reports. With 2a query you can ask questions and setparameters. 1. Select the Create tab. 3 2. In the Other group, select Query Wizard. 3. Select Simple Query Wizard and click OK. 4. Under Tables/Queries, click on the down arrow and select the tables and/or queries to create and run a new query. e.g. tblEmpInfo. 5. In the Available Fields list, select the tables field(s) to add to the query. In this example, all the fields are used; therefore, click on the double-headed arrow icon to move all the items (fields) to the Selected Fields list. 6. Click Next. 4 5 6
  • Microsoft Access 2007 - Module II7. Select a Detail or Summary. e.g. Detail8. Click on Next. 79. Type a title for the query, such as qryEmployeeComp.10. Click on either the Open the query to view information radio button or the Modify the query design radio button. e.g. Modify the query design 811. Click Finish.12. The qryEmployeeComp query is now displayed in Design View. 9 10 11 12 
  • Hillsborough Community College - Professional Development and Web ServicesQuery in Design View: Sort Sorting information can be a valuabletool when dealing with large amounts ofinformation or when simply organizinginformation (fields). More than one field canbe sorted; however, the field farthest to theleft is given priority when sorting.Fields can be sorted by: Ascending Descending 1 Not SortedIn this example, the LastName field is 2sorted in ascending order. 1. While in Design View, click in the blank box next to Sort, under Lastname; a down arrow appears. 3 2. Select the sort option. e.g. Ascending 3. In the Query Tools/Design tab>Results group, click the Run button to activate the query and see your results. 4. Go back to Design View to edit your query. 4
  • Microsoft Access 2007 - Module IIQuery in Design View: ShowThe Show option displays or hides fields ina query or form.In this example, some fields will be hidden. 1. While in Design View, uncheck the show box for Exempt, Zip Code and Street. To show fields in a query’s results, add a 1 check to each field name’s Show checkbox. To hide fields in a query’s results, remove the check in the field name’s Show checkbox. 2. Click the Run button to see your query results. Notice that the Exempt, Zip Code and Street fields are not being shown. 2 3. Select Design View to make more adjustments to the query design. 3 
  • Hillsborough Community College - Professional Development and Web ServicesQuery: Text Data CriteriaText Data is data in fields that are in textformat. Such examples include but are notlimited to names, addresses, employeenumber, location, etc.In this example, employees that are exemptare queried. 1. In the Criteria section under Exempt, type the text data criteria. 2 e.g. Yes 1 2. Check the Show box for Exempt, to show this field in the results. 3. In the Query Tools/Design tab>Results group, click the Run button. 4. The results of the query now display all employees that are Exempt. 3 4 Activity Run a query looking for employees who live in Temple Terrace. How many HCC employees live in Temple Terrace?10
  • Microsoft Access 2007 - Module IIQuery Criteria: WildcardsIn this example, the last name of an em-ployee with the letter M is queried. 2 1. Go back to Design View. In the Criteria section under LastName, type the text data criteria. e.g. M* 2. Click on the Run button. 3. The results of a query now display all employees with a last name that begins with the letter M. Wildcards are useful in Access to serve as a character or blending of characters. There are two types of wildcards in Access * (asterisk) 1 ? (question mark) The * wildcard symbolizes any compilation of characters. Therefore, mi* stands for the letters mi, followed by any letter 3 combination. The ? wildcard symbolizes any defined letter. As a result, B?rt operates as the letter, B, followed by any single letter, r, and t. Appropriately, B?rt can mean Bert or Burt.ActivityRun a query looking for employees working at a cam-pus with the letter D. How many employees work at acampus with the letter D?How would you run a query for employees workingat District? How many employees work at District? 11
  • Hillsborough Community College - Professional Development and Web ServicesQuery Criteria: Field Not inResultField Not in Result is a query where 3criteria for a specific field do not need toappear in the outcome of the final query. Inthis example, the last name, first name, andmiddle initial are necessary. However, thecampus does not need to appear. Therefore,a query with only the names of theemployees working at the Brandon campusis required. 1. In Design View, uncheck the items to be hidden. e.g. Campus 2. Type criterion in the Criteria section, under Campus. 1 e.g. BR 2 3. Click on the Run button. 4. The results of the query now display all employees at the Brandon campus. 412
  • Microsoft Access 2007 - Module IIQuery Criteria: NumberUsing a number in a criteria is useful wheninformation from a data field that consistsof numbers is required. A dollar sign ordecimal point is not required in the criterion.In this example, the names, campuses, andthe salary of employees earning $39,800.00are needed. 1. In Design View, type criterion in the Criteria section. For example, under Salary, type 39800. Do not type in the dollar sign or the decimal 1 point. Uncheck unnecessary fields, such as Street, City, State, ZipCode and Exempt. 2. Click on the Run button. 3. The results of the query now display all employees whose salary is $39,800.00. 2 3ActivityRun a query looking for employees earning $60,000.How many employees are earning $60,000? 13
  • Hillsborough Community College - Professional Development and Web ServicesQuery Criteria: ComparisonUsing a number in a criteria is useful wheninformation from a data field that consistsof numbers is required. A dollar sign ordecimal point is not required in the criterion.In this example, the names, campuses, andthe salary of employees earning more than$30,000.00 is needed. 1. In Design View, type criterion in the Criteria section. e.g. Under Salary, type >30000. Do not type in 1 the dollar sign or the decimal point. 2. Click on the Run button. 3. The results of the query now display all employees earning more than $30,000. 2 3 Activity Run a query looking for employees earning less than $30000. How many employees are earning less than $30,000?14
  • Microsoft Access 2007 - Module IIQuery Criteria: ComparisonANDUsing the AND criteria is appropriate wheninformation is needed from multiple fields.AND conditions must appear on the samecriteria line, for example, the names ofemployees earning more than $30,000.00at the Dale Mabry campus. 1. In Design View, type criterion in the Criteria section. e.g. Under Salary, type >30000. Do not type in the dollar sign or the decimal point. 2 1 2. Type the AND criterion. e.g. Under Campus, type DM. 3. Click on the Run button. 4. The results of the query now display all employees earning more than $30,000 at the 3 Dale Mabry campus. Since the two conditions are on the same 4 line, each one must be true.ActivityRun a query looking for employees working at theYbor campus and who are exempt. How many em-ployees are working at the Ybor campus and areexempt? 15
  • Hillsborough Community College - Professional Development and Web ServicesQuery Criteria:Comparison ORUsing the OR criteria is applicable when in- 2 1formation is needed from multiple fields.OR conditions must appear on the separatelines. 4In this example, the names of employeesearning less than $30,000.00 or with thelast name beginning with the letter M arerequired. 1. Type criterion in the Criteria section. Under Salary, type <30000. Do not type in the dollar sign or the decimal point. 2. Type the OR criterion. Under Last Name, type M* on a separate line. 3. Click on the Run button. 4. The results of the query now display all employees earning less than $30,000 or employees with a last name beginning with the letter M. Since the two conditions are on separate lines, at least one condition must be true. Activity Run a query looking for employees working at the Ybor (YB) campus or the Plant City (PC) campus.16
  • Microsoft Access 2007 - Module IIAggregate FunctionsAggregate functions within Access allowsthe user to carry out simple mathematicaloperations within a query. Aggregatefunctions (operations) include sum,average, minimum, maximum, count,standard deviation and variance. Thesefunctions can be accessed by selecting theTotals button on the query design toolbaror typing the aggregate function in the Totalrow of the Design grid.Aggregate Function DescriptionSum Determines the sum of field values. Supports the following data types: AutoNumber, urrency, Date/ C Time and Number.Avg Calculates the average of field values. Supports the following data types: AutoNumber, Currency, Date/ Time and Number.Min Determines the lowest field value. Supports the following data types: AutoNumber, Currency, Date/ Time, Number and Text.Max Determines the highest field value. Supports the following data types: AutoNumber, Currency, Date/ Time and Number.Count Determines the number of records in a field. Supports the following data types: AutoNumber, Currency, Date/Time, Memo, Number, OLE Object, Text and Yes/No.StDev Calculates the standard deviation of a field value. Supports the following data types: Currency or Number.Var Calculates the statistical variances of a field. Supports the following data type: Currency. 17
  • Hillsborough Community College - Professional Development and Web Services 1Query: Using the AggregateFunction CountUsing the aggregate function Count isuseful when a simple count or tally ofinformation is required. 2 1. In the Create tab>Other group, select Query Design. 2. Select the tables and/or queries to show and click Add. e.g. tblEmpInfo 3. Click Close. 3 4. Double click on a field name from the table or query twice to appear in the query design grid. e.g. Campus. 418
  • Microsoft Access 2007 - Module II 5. In the Query Tools/Design tab>Show/Hide group, click on the Totals button. 6. The Total row now appears in the design grid between Table and Sort. 5 7. Select the aggregate function on the second Campus field e.g. Count. 8. Click on the Run button. 9. Result of query using the aggregate function Count. 10. Save the query as qryCntCampus. 6 7 8ActivityCreate a query for gender using the aggregate func-tion Count. Save the query as qryCntGenderHow many are males? How many are females?How could using the aggregate function Count be 9useful to you? 19
  • Hillsborough Community College - Professional Development and Web ServicesQuery: Using the AggregateFunction AvgUsing the aggregate function Avg(average) is useful when an average of 2information is required.In this example, we are determining theaverage salary by campus. 1. Under the Create tab>Other group, select Query Design. 2. Select the tables and/or queries to show and click Add. 3 e.g. tblEmpInfo 3. Click Close. 4. Double click on the field names from the table to appear in the Field design grid. e.g. Campus and Salary. 5. Click on the Totals button. The Total row 5 now appears in the design grid between Table and Sort. 6. Select the aggregate function on the second field and click on the Run button. e.g. Avg. 7. Result of query using the aggregate function 4 Average. 8. Save the query as qryAvgSalaryCampus. 6 Activity Create a query for the average salary by city using the aggregate function Avg. Save the query as 7 qryAvgSalaryCity. Which city has the highest average salary? How could using the aggregate function Avg be use- ful to you?20
  • Microsoft Access 2007 - Module IIQuery: Using Parameters and theBetween OperatorCreating a parameter query allows you tosearch for information in fields. However, forthe parameters to function, you will have 1to enter the criteria when prompted by theparameter dialog box.In this example, we are determining thenames of the people whose start date is 2between 1/01/1980 and 12/31/1999. 1. Under the Create tab>Other group, select Query Design. 2. Select the tables and/or queries to show and click Add. e.g. tblEmpInfo 3 3. Click Close. 4. Double click on the field names from the table to appear in the Field design grid. e.g. FirstName, LastName, and StartDate. 5. Under StartDate Criteria type the following: Between [Beginning Start Date] And [Ending Start Date]. 4 5 21
  • Hillsborough Community College - Professional Development and Web Services 6. Click on the Run button and enter the following parameters Beginning Start Date: 1/01/1980 and Ending Start Date: 12/31/1999. 7. Result of query using the parameter Between. 8. Save the query as qryBtwnStartDate. 6 7 8 Activity Create a query using parameters. The query will show the names of people, salary and campus. Save the query as qryBtwSalaryCampus. Show how many people make between $30,000 and $40,000 and at which campus he/she works. What are the results for each campus?22
  • Microsoft Access 2007 - Module IICreate a Report: ReportWizardReport Wizard is easy to use and allowsfor the design, development, printing, andprint preview of information such as labels,lists, form letters, invoices, summaries, 1display charts, etc. The user can personalizereports by adding a logo or picture,organizing headers, footers and sortingcolumns.In this example, the names of employeesearning more than $30,000.00 or with the 2last name beginning with the letter M arerequired. Adjust the qryEmployeeCompquery, if necessary. 1. In the All Access Objects pane, select the object that you would like to use for 3 creating the report. For example, select qryEmployeeComp. 2. Under the Create tab>Reports group, select Report Wizard. 3. Make sure the correct table or query is selected. Add Available Fields to Selected Fields and click on Next. In this example, qryEmployeeComp should be selected and add all available fields. 4. Add any grouping levels; however, in this example do not add any. Therefore, click on Next. 4 23
  • Hillsborough Community College - Professional Development and Web Services 5. Sort records, up to four fields in ascending or descending order, and click on Next. In this example, the fields LastName and FirstName, are sorted in ascending order. 6. Choose a report layout and orientation and click 5 on Next. e.g. Tabular layout and Landscape orientation 7. Choose a report style and click on Next. e.g. Access 2007 8. Type in a report title, preview the report, or modify the report’s design and click on Finish. e.g. rptEmployeeInfo 9. The Employee Information report now appears. 6 9 7 824
  • Microsoft Access 2007 - Module IIModify a ReportDesign View and Layout View allow forthe modification and customizing of reportsby adding a logo or picture, organizingheaders, footers, and sorting columns.In this example, the Employee Informationreport is modified. 1 1. In the Home tab>Views group, select View > Design View to change to Design View. 2. The report now appears in Design View. 3. To change the font, highlight the text box, then make your font selection. For example, click 4 on the Last Name label text box and choose a larger font size. Also change the alignment to Center. 4. Select Report View see the changes. 5. Report changes are viewable. 3 To move report objects around, click on an object and drag it to the new location, while you are in Design View or Layout View. You can also resize and delete columns. 5ActivityModify rptEmployeeInfo by changing the font, sizeand color. Change the report header title to HCCEmployee Information. Delete unnecessary columnsto save space. 25
  • Hillsborough Community College - Professional Development and Web Services 1Insert a Graphic/ImagePersonalize forms and reports by adding acompany logo or another graphic. To inserta graphic into a form or report, you can bein Design View or Layout View. In thisexample, we’ll use Design View. 2 1. In the Report Design Tools/Design tab>Control group, click Image. 2. Take the image pointer and click and hold, then 3 draw a rectangle to the approximate size of the graphic in the location where the image will appear. Release mouse button after the Image box is drawn. In this example, the HCC logo is added to the report header. 3. After the Insert Picture dialog box appears, locate the file and click on OK. e.g. Desktop > PDWS Folder > Access II> HCCLogo. 4 4. Resize graphic with sizing handles.26
  • Microsoft Access 2007 - Module IIResize Image/GraphicSometimes after an image is placed on aform or report, it does not fit properly in itsbox. Below are the steps to resize an image 1without resizing the box entirely. 1. Select the image. 2. Right click on the mouse and click on Properties. 3. Click on the Format tab. 4. Point to and click on Size Mode down arrow and choose Stretch. 5. The image now fits in the box. 2 3 4Activity Insert an image into your report and resize the image using the Resize Image/Graphic steps. 5 27
  • Hillsborough Community College - Professional Development and Web Services28