599CD.com Access Calendar Updates   Collapse Menus
 
 
NEW Courses - Access Imaging, Excel 2007 Level 5 dismiss
 
   
 

What's New?  |  Courses  |  Theater  |  Demo  |  Tips  |  Blog  |  Forums  |  Search  |  Help  |  Order

 
What do you want to learn today? 
 
 
Courses - Microsoft Access 221
Description: Advanced Access Queries, Part 2
Running Time: 110 minutes
Pre-Requisites: Access 220 very strongly recommended
Versions:
We use Access XP in this course, but the lessons are valid for all versions of Access from 95 to 2003. There are cosmetic changes in Access 2007. Order before 3/13/2010 to get a FREE upgrade to our 2007 version when released!
 
Microsoft Access 221
Advanced Access Queries 2

Aggregate Queries, Total Amount Due for Customers, SUM in Footer, Hours Worked, Employee Timesheet, More. 65 Minutes.
 

AC221 Major Topics

  • Aggregate Queries
  • Grouping in Excel
  • Total Amount Due Per Customer
  • Last Date Customer Contacted
  • SUM in Report Footer
  • Calculate Hours Worked
  • Employee Timesheet

This class continues our look at Advanced Query Techniques. This is part 2 of the series. We're going to learn all about Aggregate Queries, also known as Summary Queries or Totals Queries. Aggregate Queries allow you to group data together and get sums, averages, counts, and so on.

We'll begin by taking a look at exactly how we can group information together using Microsoft Excel, so we have a familiar ground to start on... for those of you who have worked with Excel before.

 

Next we'll see how we can create an Aggregate Query using Microsoft Access.

 

This query, for example, will allow us to group all of our customer records together that may have the same name (for example, if we have 2 or more different offices for 'XYZ Corp' in our database) and show all of their AmountDue values summed together. We'll also learn about averages, max, min, count, and other summary functions.

 

Next we'll create a similar function to show all of the sales in our database (using the OrderLog we created in a previous class) grouped by the customer's state. This way we can see all of our sales from NY, CA, etc.

 

I'll also show you how to generate this list for sales between two dates - so you can specify a begin date and and end date and see all of your sales, by state, for the month of February (for example).

We'll next learn how to take our list of customers and generate a query showing the date of the last time we contacted that customer. This is done by joining our customer table with our contact history table, and finding the most recent contact date.

 

Next we'll make a report showing all of our customers sales grouped by state, between two dates. This will teach you how to put SUM calculations in report footers. Very powerful stuff.

 

Our next example comes from the "by popular request" folder. Lots of people have asked me how to deal with tracking HOURLY work in Access. Whether you need to track employees, billable service hours, or any kind of hourly information, this lesson will help you.

We'll create a WorkLog table that will track an employee, time in, and time out. We'll make a query that will then automatically calculate the total number of hours in that "shift."

 

We'll make a nice data entry form so our secretary can just select the employee's name from a list and type in his hours.

 

Now that I have all of this time information, I want to be able to bring up an employee timesheet. So, I want a form where I can select the employee and specify a range of dates...

 

I want to be able to click on a button and see their timetable information...

 

Or print out a full timesheet and give it to them or the payroll company.

 

As a bonus, I'll even teach you how to store their hourly pay rate in the employee table and then calculate how much they get paid!

 

Now, whether or not you actually have to work with employee times, this lesson is invaluable in teaching you how to create sums, totals, averages, and other calculations in your forms, reports, and queries. We'll learn about a whole new powerful class of queries that - if you learn how to master them - can make your databases give you the kinds of information you expect from a professional quality database.

 

 

Access 221 Outline
 

1. Aggregate Queries
Summary Queries
Totals Queries
Group Different Records Together
Sums, Averages, Counts
Examples in Excel (for understanding)
Sorting in Excel
Data > Subtotals in Excel
Grouping in Excel

2. Build an Aggregate Query
List of Unique Customer Names Only
Essentially Eliminate Duplicates
Totals Button in Query Design
Show Total Amount Due by Customer
Max Value
Count of Records
Average (Avg) of Amounts

3. Sales Totals By State
Group by State
First Record
Unique Phone List of Customers
Sales Totals by State
Add a Date Criteria
Add Parameters

4. Most Recent Contact Date
When was the last time you contacted a customer?
Show all customers and contacts if they exist
Outer Join on CustomerID
Show Min of DateTime
Oldest Contact Date for Each Customer
Count of Contacts for Each Customer
Renaming Query Fields
Limit by State with Criteria
In() Function
In("TX","NY")

5. Sales Totals by State
Report Page Header & Footer
Sorting & Grouping Levels
Group Footer Visible
Report Section Footer
SUM Total in Group Footer
Visible Property - Hide Report Fields, Labels

6. Employee Time Sheets
Table to Track Time In, Time Out
Join WorkLogT to EmployeeT
Calculate Hours Worked
SUM Up Hours Worked per Employee
CDate Function - Convert To Date

7. Work Log Form
Employee Combo Box
Hours Worked SUM Total in Form Footer
Filter By Employee
Button On Main Menu

8. Time Sheet Form
Parameter Form to Select Employee and Date Range
Display Time Sheet Based on Parameters Entered
Forms!FormName!FieldName
Get EmployeeID From Time Sheet Form
Run Query from Command Button Wizard

9. Time Sheet Report
Employee Data in Group Header
Hourly Data in Detail Section
SUM Hours Worked in Employee Footer
Command Button to Preview Report
"Print Timesheet" Button
Enter Hourly Pay
Calculate Amount Earned

 


Try a FREE Demo Lesson

 
 

Huge Discounts Available
When you purchase multiple classes together
Huge savings up to 50% off! Order Now.
 

Student Interaction: Microsoft Access 221

Richard on 1/1/2007:  Aggregate (Summary) Queries. Sums, averages, counts, etc. in Queries, Report/Form Footers, Employee Timesheets
Abdul Nwiran on 9/9/2008: Please Can you Show Me How to do overtime calcolation on timesheet . Thanks Richard
Richard Rost on 9/9/2008: Abdul, I spend a LOT of time covering calculating employee pay in Access 306.
Edward  Anderson on 9/18/2008: How to average a row in a query? For example:There are three column heading with Home work assignment grades one per column 1 thru 3 how can these grades be averaged
Richard Rost on 9/18/2008: Well, if you know there are always going to be 3 and exactly 3 fields, you can just make a new calculated query field: MyAverage: (F1+F2+F3)/3 That will give you the average of the three. If the number of fields is variable, then we need to do a little more work.
Richard Rost on 10/4/2008: Yes, this course will cover calculating the correct number of hours even if your times span midnight. For example, if your employee starts work at 10pm and finishes at 6am the following day, the timesheet will still be correct.
Greg Paradise on 3/2/2009: I would like to see the overtime segment and may already have it since this was from 06'....but you said drop a comment. Its dropped;)
Greg Paradise on 3/2/2009: The other thing I would like to learn is how to fomat time in 100 units per hour. That seems to be the norm in AS400 and QAD software and I would like to be able to communicate back and fourth. Again I have all the classes and this may be in one. Let me know. Thanks, Paradise
Richard Rost on 3/5/2009: I'll add it to my to-do list (which is now overflowing).
Richard Rost on 3/5/2009: Greg, I have not covered this. You mean you want to calculate time like 15.2 hours? That's just a matter of converting your "number of hours" value (field/calculation/whatever) into a double or decimal value.
Greg Paradise on 3/5/2009: Yes that is what I would like to do and I have tried different formats and I don't seem to be able to get them to accept a decimal...I just get a zero when I enter or tab past the field?? I'm sure Currency would give me decimals but I don't think that will help. I've gone into the properties and set decimal places....nothing. Keep up the good work, I'm sending referrals your way.
Richard Rost on 3/6/2009: Greg, are you using DOUBLE, SINGLE, or DECIMAL for your data type? If you use any of the INTEGER types, they'll get rounded off.
Greg Paradise on 3/6/2009: That was my problem I put it to double and it is working now. Thank you!
Richard Rost on 3/9/2009: Greg, you're very welcome.
hassan ali on 8/30/2009: Please could you let me know which Access did you make the table for every time you talk to a customer table in the customer form?
Richard Rost on 8/30/2009: Hassan, I believe that's the Contacts Subform and we covered it in Access 202.
 
 

You may want to read these articles from the 599CD Blog:

 

 

Need Help
 
Do you have questions about Word, Excel, Access, Web Design, or computers in general? Just ask us anything you'd like. Click here for assistance.
 

Get Free Tips & Tricks
 

Join our mailing list today and get information on our Free Tips & Tricks Newsletter including free video tutorials, eBooks, live seminars, and more.

Email:
Name:
Type in the word to the left:
 
Your email will be kept 100% safe and will never be given to 3rd parties.
 


CLICK HERE for a FREE lesson



Order your first 599CD course now.
Your Satisfaction is Guaranteed!


Subscribe to our RSS FeedWhat's This?

599CD on Facebook  599CD on Twitter  Subscribe to RSS Feed  Add to Live Bookmarks  Add to My AOL  Add to MyYahoo  Add to Google Reader or Homepage    hide help

599CD Home   |   Learn More   |   What's New?   |   Contact Us   |   Free Demo   |   FAQs   |   Order Now   |   Affiliate Program   |   TechHelp   |   MYOLP   |   Jobs   |   Downloads   |   Handbooks  (Text)   |    Mailing List   |   Lost Passwords   |   Referral Program   |   Online Poll   |   Corporate, Educational, Government, Non-Profit Sales   |   Message Forums   |   Testimonials   |   Privacy Policy   |   Free Gift CDs   |   Tips & Tricks

 
 

What's New  |  Home  |  Courses  |  Demo  |  Learn More  |  Contact  |  Order