SlideShare una empresa de Scribd logo
1 de 34
Descargar para leer sin conexión
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 Services




The material contained in this training material is copyrighted ©2007 Hillsborough
Community College Department of Professional Development and Web Services and
may not be reproduced without express, written permission. Other trademarks, trade
names, 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 II




Table 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 II




Objectives
  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 II




Import a Table From Excel	
Access and Excel work well together. It is
quite simple to import data from an already
existing Excel spreadsheet.

In this example, we are using the files                            1
located on your computer’s desktop, in the
PDWS 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 tabImport 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 II




Export an Access Table to
Excel
Any database table can be exported, in a

                                                                            2
variety of formats. In this example, we are
going to export to Excel.

  1. 	 In the Navigation Pane, select the object to      1
       export,
  	   e.g. tblEmpInfo
  2. 	 In the External Data tabExport 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 Services



Create a Query	
A query allows for table inquiries. A query
can change, delete, add, and arrange                                             1
data in tables. Queries also aid gathering
information for forms and reports. With                                              2
a query you can ask questions and set
parameters.

    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 table's
         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 II



7.	 Select a Detail or Summary.
	   e.g. Detail
8.	 Click on Next.                                7
9.	 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                                8
11.	 Click Finish.
12.	 The qryEmployeeComp query is now
     displayed in Design View.

                                                            9



                                                              10
                                                                            11




                                           12
Hillsborough Community College - Professional Development and Web Services



Query in Design View: Sort	
Sorting information can be a valuable
tool when dealing with large amounts of
information or when simply organizing
information (fields). More than one field can
be sorted; however, the field farthest to the
left is given priority when sorting.

Fields can be sorted by:
	     Ascending
	     Descending                                                                     1
	     Not Sorted

In this example, the LastName field is                                           2
sorted 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 tabResults 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 II



Query in Design View: Show
The Show option displays or hides fields in
a 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 Services




Query: Text Data Criteria
Text Data is data in fields that are in text
format. Such examples include but are not
limited to names, addresses, employee
number, location, etc.

In this example, employees that are exempt
are 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 tabResults 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 II



Query Criteria: Wildcards
In 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.




Activity
Run a query looking for employees working at a cam-
pus with the letter D. How many employees work at a
campus with the letter D?

How would you run a query for employees working
at District? How many employees work at District?




                                                                                          11
Hillsborough Community College - Professional Development and Web Services



Query Criteria: Field Not in
Result

Field Not in Result is a query where
                                                                             3
criteria for a specific field do not need to
appear in the outcome of the final query. In
this example, the last name, first name, and
middle initial are necessary. However, the
campus does not need to appear. Therefore,
a query with only the names of the
employees working at the Brandon campus
is 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.

                                                                                 4




12
Microsoft Access 2007 - Module II



Query Criteria: Number

Using a number in a criteria is useful when
information from a data field that consists
of numbers is required. A dollar sign or
decimal point is not required in the criterion.

In this example, the names, campuses, and
the salary of employees earning $39,800.00
are 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

                                                        3




Activity
Run a query looking for employees earning $60,000.
How many employees are earning $60,000?




                                                                                          13
Hillsborough Community College - Professional Development and Web Services



Query Criteria: Comparison
Using a number in a criteria is useful when
information from a data field that consists
of numbers is required. A dollar sign or
decimal point is not required in the criterion.

In this example, the names, campuses, and
the 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 II



Query Criteria: Comparison
AND
Using the AND criteria is appropriate when
information is needed from multiple fields.

AND conditions must appear on the same
criteria line, for example, the names of
employees earning more than $30,000.00
at 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.




Activity
Run a query looking for employees working at the
Ybor campus and who are exempt. How many em-
ployees are working at the Ybor campus and are
exempt?


                                                                                         15
Hillsborough Community College - Professional Development and Web Services



Query Criteria:
Comparison OR
Using the OR criteria is applicable when in-                                 2       1
formation is needed from multiple fields.

OR conditions must appear on the separate
lines.                                                                           4
In this example, the names of employees
earning less than $30,000.00 or with the
last name beginning with the letter M are
required.

     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 II



Aggregate Functions
Aggregate functions within Access allows
the user to carry out simple mathematical
operations within a query. Aggregate
functions (operations) include sum,
average, minimum, maximum, count,
standard deviation and variance. These
functions can be accessed by selecting the
Totals button on the query design toolbar
or typing the aggregate function in the Total
row of the Design grid.

Aggregate Function	                 Description
Sum		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




                                                                                     1



Query: Using the Aggregate
Function Count
Using the aggregate function Count is
useful when a simple count or tally of
information is required.
                                                                             2
     1. 	 In the Create tabOther 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.




                                                                                 4




18
Microsoft Access 2007 - Module II



 5.	 In the Query Tools/Design tabShow/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




                                                                          8
Activity
Create a query for gender using the aggregate func-
tion Count. Save the query as qryCntGender

How many are males? How many are females?

How could using the aggregate function Count be                     9
useful to you?




                                                                                        19
Hillsborough Community College - Professional Development and Web Services



Query: Using the Aggregate
Function Avg
Using the aggregate function Avg
(average) is useful when an average of                                           2
information is required.

In this example, we are determining the
average salary by campus.

     1. 	 Under the Create tabOther 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 II



Query: Using Parameters and the
Between Operator
Creating a parameter query allows you to
search for information in fields. However, for
the parameters to function, you will have                                  1
to enter the criteria when prompted by the
parameter dialog box.

In this example, we are determining the
names of the people whose start date is
                                                       2
between 1/01/1980 and 12/31/1999.

   1.	 Under the Create tabOther 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 II



Create a Report: Report
Wizard
Report Wizard is easy to use and allows
for the design, development, printing, and
print preview of information such as labels,
lists, form letters, invoices, summaries,                 1
display charts, etc. The user can personalize
reports by adding a logo or picture,
organizing headers, footers and sorting
columns.

In this example, the names of employees
earning more than $30,000.00 or with the                  2
last name beginning with the letter M are
required. Adjust the qryEmployeeComp
query, 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 tabReports 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




                                                                                         8


24
Microsoft Access 2007 - Module II



Modify a Report
Design View and Layout View allow for
the modification and customizing of reports
by adding a logo or picture, organizing
headers, footers, and sorting columns.

In this example, the Employee Information
report is modified.                                          1
  1. 	 In the Home tabViews 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.




                                                                           5




Activity
Modify rptEmployeeInfo by changing the font, size
and color. Change the report header title to HCC
Employee Information. Delete unnecessary columns
to save space.


                                                                                               25
Hillsborough Community College - Professional Development and Web Services




                                                                                 1
Insert a Graphic/Image
Personalize forms and reports by adding a
company logo or another graphic. To insert
a graphic into a form or report, you can be
in Design View or Layout View. In this
example, we’ll use Design View.                                                  2
     1. 	In the Report Design Tools/Design
         tabControl 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 II



Resize Image/Graphic
Sometimes after an image is placed on a
form or report, it does not fit properly in its
box. Below are the steps to resize an image              1
without 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


                                                                     4



Activity
 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 Services




28

Más contenido relacionado

La actualidad más candente

computer-6th-primary-2nd-term (2)
computer-6th-primary-2nd-term (2)computer-6th-primary-2nd-term (2)
computer-6th-primary-2nd-term (2)khawagah
 
Excel 2003 Charts
Excel 2003 ChartsExcel 2003 Charts
Excel 2003 Chartsbdthang
 
Sql server 2012 transact sql dml reference
Sql server 2012 transact sql dml referenceSql server 2012 transact sql dml reference
Sql server 2012 transact sql dml referenceU.N.S.C
 
Location logic working_with_content
Location logic working_with_contentLocation logic working_with_content
Location logic working_with_contentsorenk22
 
Database
DatabaseDatabase
DatabaseRū Sh
 
Form4 cd4
Form4 cd4Form4 cd4
Form4 cd4smktsj2
 
Frame analysis by autodesk inventor 2012
Frame analysis by autodesk inventor 2012Frame analysis by autodesk inventor 2012
Frame analysis by autodesk inventor 2012HaGun Gunawan
 
Stress analysis 3 d auto cad by autodesk inventor
Stress analysis 3 d auto cad by autodesk inventorStress analysis 3 d auto cad by autodesk inventor
Stress analysis 3 d auto cad by autodesk inventorHaGun Gunawan
 
Manual de macros en calc
Manual de macros en calcManual de macros en calc
Manual de macros en calcBerthamazon
 
Microsoft Office Access 2003 Tutorial for Beginners
Microsoft Office Access 2003 Tutorial for BeginnersMicrosoft Office Access 2003 Tutorial for Beginners
Microsoft Office Access 2003 Tutorial for BeginnersAimina Salsabila
 
CIC_Manual.pdf
CIC_Manual.pdfCIC_Manual.pdf
CIC_Manual.pdfRMani7
 

La actualidad más candente (15)

computer-6th-primary-2nd-term (2)
computer-6th-primary-2nd-term (2)computer-6th-primary-2nd-term (2)
computer-6th-primary-2nd-term (2)
 
TechWriterSamples
TechWriterSamplesTechWriterSamples
TechWriterSamples
 
Excel 2003 Charts
Excel 2003 ChartsExcel 2003 Charts
Excel 2003 Charts
 
Sql server 2012 transact sql dml reference
Sql server 2012 transact sql dml referenceSql server 2012 transact sql dml reference
Sql server 2012 transact sql dml reference
 
Formats
FormatsFormats
Formats
 
Location logic working_with_content
Location logic working_with_contentLocation logic working_with_content
Location logic working_with_content
 
DB2 DOCUMENT
DB2 DOCUMENTDB2 DOCUMENT
DB2 DOCUMENT
 
Chapter.09
Chapter.09Chapter.09
Chapter.09
 
Database
DatabaseDatabase
Database
 
Form4 cd4
Form4 cd4Form4 cd4
Form4 cd4
 
Frame analysis by autodesk inventor 2012
Frame analysis by autodesk inventor 2012Frame analysis by autodesk inventor 2012
Frame analysis by autodesk inventor 2012
 
Stress analysis 3 d auto cad by autodesk inventor
Stress analysis 3 d auto cad by autodesk inventorStress analysis 3 d auto cad by autodesk inventor
Stress analysis 3 d auto cad by autodesk inventor
 
Manual de macros en calc
Manual de macros en calcManual de macros en calc
Manual de macros en calc
 
Microsoft Office Access 2003 Tutorial for Beginners
Microsoft Office Access 2003 Tutorial for BeginnersMicrosoft Office Access 2003 Tutorial for Beginners
Microsoft Office Access 2003 Tutorial for Beginners
 
CIC_Manual.pdf
CIC_Manual.pdfCIC_Manual.pdf
CIC_Manual.pdf
 

Destacado

6 data types
6 data types6 data types
6 data typesjigeno
 
14 exception handling
14 exception handling14 exception handling
14 exception handlingjigeno
 
15 functional programming
15 functional programming15 functional programming
15 functional programmingjigeno
 
8 statement-level control structure
8 statement-level control structure8 statement-level control structure
8 statement-level control structurejigeno
 
15 functional programming
15 functional programming15 functional programming
15 functional programmingjigeno
 
12 object oriented programming
12 object oriented programming12 object oriented programming
12 object oriented programmingjigeno
 
7 expressions and assignment statements
7 expressions and assignment statements7 expressions and assignment statements
7 expressions and assignment statementsjigeno
 
1 preliminaries
1 preliminaries1 preliminaries
1 preliminariesjigeno
 
4 lexical and syntax analysis
4 lexical and syntax analysis4 lexical and syntax analysis
4 lexical and syntax analysisjigeno
 

Destacado (9)

6 data types
6 data types6 data types
6 data types
 
14 exception handling
14 exception handling14 exception handling
14 exception handling
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
 
8 statement-level control structure
8 statement-level control structure8 statement-level control structure
8 statement-level control structure
 
15 functional programming
15 functional programming15 functional programming
15 functional programming
 
12 object oriented programming
12 object oriented programming12 object oriented programming
12 object oriented programming
 
7 expressions and assignment statements
7 expressions and assignment statements7 expressions and assignment statements
7 expressions and assignment statements
 
1 preliminaries
1 preliminaries1 preliminaries
1 preliminaries
 
4 lexical and syntax analysis
4 lexical and syntax analysis4 lexical and syntax analysis
4 lexical and syntax analysis
 

Similar a Access2007 m2

Informatica complex transformation ii
Informatica complex transformation iiInformatica complex transformation ii
Informatica complex transformation iiAmit Sharma
 
Informatica complex transformation i
Informatica complex transformation iInformatica complex transformation i
Informatica complex transformation iAmit Sharma
 
Xcelsius Best Practices 2008
Xcelsius Best Practices 2008Xcelsius Best Practices 2008
Xcelsius Best Practices 2008BI Brainz Group
 
Guide to excel
Guide to excelGuide to excel
Guide to excelaccgenius2
 
Xml transformation-doc
Xml transformation-docXml transformation-doc
Xml transformation-docAmit Sharma
 
Deploying customizations across microsoft dynamics ax 2012 environments ax2012
Deploying customizations across microsoft dynamics ax 2012 environments ax2012Deploying customizations across microsoft dynamics ax 2012 environments ax2012
Deploying customizations across microsoft dynamics ax 2012 environments ax2012Prathamesh Joshi
 
Ibm spss conjoint
Ibm spss conjointIbm spss conjoint
Ibm spss conjointDũ Lê Anh
 
Excel2007 analysisservicescubespivottables
Excel2007 analysisservicescubespivottablesExcel2007 analysisservicescubespivottables
Excel2007 analysisservicescubespivottablesAnicet Dobe
 
Sap business-object-universe-idt-lab-i
Sap business-object-universe-idt-lab-iSap business-object-universe-idt-lab-i
Sap business-object-universe-idt-lab-iAmit Sharma
 
Sas visual analytics Training
Sas visual analytics Training Sas visual analytics Training
Sas visual analytics Training bidwhm
 
Style Intelligence Evaluation Documentation
Style Intelligence Evaluation DocumentationStyle Intelligence Evaluation Documentation
Style Intelligence Evaluation DocumentationArleneWatson
 
Create a basic performance point dashboard epc
Create a basic performance point dashboard   epcCreate a basic performance point dashboard   epc
Create a basic performance point dashboard epcEPC Group
 
Stat planet - tutorial
Stat planet - tutorialStat planet - tutorial
Stat planet - tutorialSathya Seelan
 
Sql server 2012 tutorials reporting services
Sql server 2012 tutorials   reporting servicesSql server 2012 tutorials   reporting services
Sql server 2012 tutorials reporting servicesSteve Xu
 
Class6 term2 2019-20
Class6 term2 2019-20Class6 term2 2019-20
Class6 term2 2019-20Andrew Raj
 

Similar a Access2007 m2 (20)

Dbi h315
Dbi h315Dbi h315
Dbi h315
 
Informatica complex transformation ii
Informatica complex transformation iiInformatica complex transformation ii
Informatica complex transformation ii
 
Informatica complex transformation i
Informatica complex transformation iInformatica complex transformation i
Informatica complex transformation i
 
Xcelsius Best Practices 2008
Xcelsius Best Practices 2008Xcelsius Best Practices 2008
Xcelsius Best Practices 2008
 
Guide to excel
Guide to excelGuide to excel
Guide to excel
 
Xml transformation-doc
Xml transformation-docXml transformation-doc
Xml transformation-doc
 
Word 2007 1
Word 2007 1Word 2007 1
Word 2007 1
 
Deploying customizations across microsoft dynamics ax 2012 environments ax2012
Deploying customizations across microsoft dynamics ax 2012 environments ax2012Deploying customizations across microsoft dynamics ax 2012 environments ax2012
Deploying customizations across microsoft dynamics ax 2012 environments ax2012
 
Spss basics tutorial
Spss basics tutorialSpss basics tutorial
Spss basics tutorial
 
Ibm spss conjoint
Ibm spss conjointIbm spss conjoint
Ibm spss conjoint
 
Excel2007 analysisservicescubespivottables
Excel2007 analysisservicescubespivottablesExcel2007 analysisservicescubespivottables
Excel2007 analysisservicescubespivottables
 
Sap business-object-universe-idt-lab-i
Sap business-object-universe-idt-lab-iSap business-object-universe-idt-lab-i
Sap business-object-universe-idt-lab-i
 
Innovyze Infonet Manual
Innovyze Infonet ManualInnovyze Infonet Manual
Innovyze Infonet Manual
 
Sas visual analytics Training
Sas visual analytics Training Sas visual analytics Training
Sas visual analytics Training
 
Style Intelligence Evaluation Documentation
Style Intelligence Evaluation DocumentationStyle Intelligence Evaluation Documentation
Style Intelligence Evaluation Documentation
 
Create a basic performance point dashboard epc
Create a basic performance point dashboard   epcCreate a basic performance point dashboard   epc
Create a basic performance point dashboard epc
 
Stat planet - tutorial
Stat planet - tutorialStat planet - tutorial
Stat planet - tutorial
 
Sql server 2012 tutorials reporting services
Sql server 2012 tutorials   reporting servicesSql server 2012 tutorials   reporting services
Sql server 2012 tutorials reporting services
 
Class6 term2 2019-20
Class6 term2 2019-20Class6 term2 2019-20
Class6 term2 2019-20
 
Chartnexus manual for learning
Chartnexus manual for learningChartnexus manual for learning
Chartnexus manual for learning
 

Más de jigeno

Access2007 part1
Access2007 part1Access2007 part1
Access2007 part1jigeno
 
Basic introduction to ms access
Basic introduction to ms accessBasic introduction to ms access
Basic introduction to ms accessjigeno
 
16 logical programming
16 logical programming16 logical programming
16 logical programmingjigeno
 
13 concurrency
13 concurrency13 concurrency
13 concurrencyjigeno
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data typesjigeno
 
9 subprograms
9 subprograms9 subprograms
9 subprogramsjigeno
 
5 names
5 names5 names
5 namesjigeno
 
3 describing syntax and semantics
3 describing syntax and semantics3 describing syntax and semantics
3 describing syntax and semanticsjigeno
 
2 evolution of the major programming languages
2 evolution of the major programming languages2 evolution of the major programming languages
2 evolution of the major programming languagesjigeno
 

Más de jigeno (10)

Access2007 part1
Access2007 part1Access2007 part1
Access2007 part1
 
Basic introduction to ms access
Basic introduction to ms accessBasic introduction to ms access
Basic introduction to ms access
 
Bsit1
Bsit1Bsit1
Bsit1
 
16 logical programming
16 logical programming16 logical programming
16 logical programming
 
13 concurrency
13 concurrency13 concurrency
13 concurrency
 
11 abstract data types
11 abstract data types11 abstract data types
11 abstract data types
 
9 subprograms
9 subprograms9 subprograms
9 subprograms
 
5 names
5 names5 names
5 names
 
3 describing syntax and semantics
3 describing syntax and semantics3 describing syntax and semantics
3 describing syntax and semantics
 
2 evolution of the major programming languages
2 evolution of the major programming languages2 evolution of the major programming languages
2 evolution of the major programming languages
 

Access2007 m2

  • 1. Microsoft Access 2007 Module 2 http://pds.hccfl.edu/pds
  • 2.
  • 3. Microsoft Access 2007: Module 2 August 2007 ©2007 Hillsborough Community College - Professional Development and Web Services
  • 4. Hillsborough Community College - Professional Development and Web Services The material contained in this training material is copyrighted ©2007 Hillsborough Community College Department of Professional Development and Web Services and may not be reproduced without express, written permission. Other trademarks, trade names, logos, designs, brand names, and product services mentioned in this publica- tion may be trademarks or registered trademarks of third parties.
  • 5. Microsoft Access 2007 - Module II Table 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
  • 6.
  • 7. Microsoft Access 2007 - Module II Objectives 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.
  • 8. Hillsborough Community College - Professional Development and Web Services
  • 9. Microsoft Access 2007 - Module II Import a Table From Excel Access and Excel work well together. It is quite simple to import data from an already existing Excel spreadsheet. In this example, we are using the files 1 located on your computer’s desktop, in the PDWS 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 tabImport 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.
  • 10. 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
  • 11. Microsoft Access 2007 - Module II Export an Access Table to Excel Any database table can be exported, in a 2 variety of formats. In this example, we are going to export to Excel. 1. In the Navigation Pane, select the object to 1 export, e.g. tblEmpInfo 2. In the External Data tabExport 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
  • 12. Hillsborough Community College - Professional Development and Web Services Create a Query A query allows for table inquiries. A query can change, delete, add, and arrange 1 data in tables. Queries also aid gathering information for forms and reports. With 2 a query you can ask questions and set parameters. 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 table's 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
  • 13. Microsoft Access 2007 - Module II 7. Select a Detail or Summary. e.g. Detail 8. Click on Next. 7 9. 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 8 11. Click Finish. 12. The qryEmployeeComp query is now displayed in Design View. 9 10 11 12
  • 14. Hillsborough Community College - Professional Development and Web Services Query in Design View: Sort Sorting information can be a valuable tool when dealing with large amounts of information or when simply organizing information (fields). More than one field can be sorted; however, the field farthest to the left is given priority when sorting. Fields can be sorted by: Ascending Descending 1 Not Sorted In this example, the LastName field is 2 sorted 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 tabResults group, click the Run button to activate the query and see your results. 4. Go back to Design View to edit your query. 4
  • 15. Microsoft Access 2007 - Module II Query in Design View: Show The Show option displays or hides fields in a 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
  • 16. Hillsborough Community College - Professional Development and Web Services Query: Text Data Criteria Text Data is data in fields that are in text format. Such examples include but are not limited to names, addresses, employee number, location, etc. In this example, employees that are exempt are 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 tabResults 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
  • 17. Microsoft Access 2007 - Module II Query Criteria: Wildcards In 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. Activity Run a query looking for employees working at a cam- pus with the letter D. How many employees work at a campus with the letter D? How would you run a query for employees working at District? How many employees work at District? 11
  • 18. Hillsborough Community College - Professional Development and Web Services Query Criteria: Field Not in Result Field Not in Result is a query where 3 criteria for a specific field do not need to appear in the outcome of the final query. In this example, the last name, first name, and middle initial are necessary. However, the campus does not need to appear. Therefore, a query with only the names of the employees working at the Brandon campus is 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. 4 12
  • 19. Microsoft Access 2007 - Module II Query Criteria: Number Using a number in a criteria is useful when information from a data field that consists of numbers is required. A dollar sign or decimal point is not required in the criterion. In this example, the names, campuses, and the salary of employees earning $39,800.00 are 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 3 Activity Run a query looking for employees earning $60,000. How many employees are earning $60,000? 13
  • 20. Hillsborough Community College - Professional Development and Web Services Query Criteria: Comparison Using a number in a criteria is useful when information from a data field that consists of numbers is required. A dollar sign or decimal point is not required in the criterion. In this example, the names, campuses, and the 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
  • 21. Microsoft Access 2007 - Module II Query Criteria: Comparison AND Using the AND criteria is appropriate when information is needed from multiple fields. AND conditions must appear on the same criteria line, for example, the names of employees earning more than $30,000.00 at 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. Activity Run a query looking for employees working at the Ybor campus and who are exempt. How many em- ployees are working at the Ybor campus and are exempt? 15
  • 22. Hillsborough Community College - Professional Development and Web Services Query Criteria: Comparison OR Using the OR criteria is applicable when in- 2 1 formation is needed from multiple fields. OR conditions must appear on the separate lines. 4 In this example, the names of employees earning less than $30,000.00 or with the last name beginning with the letter M are required. 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
  • 23. Microsoft Access 2007 - Module II Aggregate Functions Aggregate functions within Access allows the user to carry out simple mathematical operations within a query. Aggregate functions (operations) include sum, average, minimum, maximum, count, standard deviation and variance. These functions can be accessed by selecting the Totals button on the query design toolbar or typing the aggregate function in the Total row of the Design grid. Aggregate Function Description Sum 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
  • 24. Hillsborough Community College - Professional Development and Web Services 1 Query: Using the Aggregate Function Count Using the aggregate function Count is useful when a simple count or tally of information is required. 2 1. In the Create tabOther 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. 4 18
  • 25. Microsoft Access 2007 - Module II 5. In the Query Tools/Design tabShow/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 8 Activity Create a query for gender using the aggregate func- tion Count. Save the query as qryCntGender How many are males? How many are females? How could using the aggregate function Count be 9 useful to you? 19
  • 26. Hillsborough Community College - Professional Development and Web Services Query: Using the Aggregate Function Avg Using the aggregate function Avg (average) is useful when an average of 2 information is required. In this example, we are determining the average salary by campus. 1. Under the Create tabOther 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
  • 27. Microsoft Access 2007 - Module II Query: Using Parameters and the Between Operator Creating a parameter query allows you to search for information in fields. However, for the parameters to function, you will have 1 to enter the criteria when prompted by the parameter dialog box. In this example, we are determining the names of the people whose start date is 2 between 1/01/1980 and 12/31/1999. 1. Under the Create tabOther 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
  • 28. 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
  • 29. Microsoft Access 2007 - Module II Create a Report: Report Wizard Report Wizard is easy to use and allows for the design, development, printing, and print preview of information such as labels, lists, form letters, invoices, summaries, 1 display charts, etc. The user can personalize reports by adding a logo or picture, organizing headers, footers and sorting columns. In this example, the names of employees earning more than $30,000.00 or with the 2 last name beginning with the letter M are required. Adjust the qryEmployeeComp query, 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 tabReports 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
  • 30. 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 8 24
  • 31. Microsoft Access 2007 - Module II Modify a Report Design View and Layout View allow for the modification and customizing of reports by adding a logo or picture, organizing headers, footers, and sorting columns. In this example, the Employee Information report is modified. 1 1. In the Home tabViews 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. 5 Activity Modify rptEmployeeInfo by changing the font, size and color. Change the report header title to HCC Employee Information. Delete unnecessary columns to save space. 25
  • 32. Hillsborough Community College - Professional Development and Web Services 1 Insert a Graphic/Image Personalize forms and reports by adding a company logo or another graphic. To insert a graphic into a form or report, you can be in Design View or Layout View. In this example, we’ll use Design View. 2 1. In the Report Design Tools/Design tabControl 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
  • 33. Microsoft Access 2007 - Module II Resize Image/Graphic Sometimes after an image is placed on a form or report, it does not fit properly in its box. Below are the steps to resize an image 1 without 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 4 Activity Insert an image into your report and resize the image using the Resize Image/Graphic steps. 5 27
  • 34. Hillsborough Community College - Professional Development and Web Services 28