Results 1 to 6 of 6
  1. #1
    betterthan74 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    3

    payroll query - not sure how to approach it. check if rep worked holidays.

    I need Ideas on how to approach a query in access 2007. Its to figure bonus for working particular days I have two tables that are imported from different software One table is daily and lists each employee ID, their part/full-time/oncall code status and hours worked each day Date | ID - | jobcode | hours worked | 8/01/2012 | 003 | Full | 8 | 8/01/2012 | 004 | Part | 4 | 8/02/2012 | 003 | Full | 8 | 8/02/2012 | 004 | part | 5 | My second table has a holiday beginning and end day and how many total hours each type of employee must work those days or range of days begin | End | Parttime | Fulltime | 8/01/2012 | 8/01/2012 | 4 | 8 | 9/01/2012 | 9/02/2012 | 4 | 12 | 10/01/2012 | 8/01/2012 | 4 | 8 | 11/01/2012 | 8/01/2012 | 4 | 8 | There are about 30 holidays in a year and if an employee works the required hours they get a bonus after one year. I need to create a query that Tells me the holidays the employess did not meet their requiement and how much they were off by. I've thought of doing it in vba where I am more comfortable with the language. is that the better route? Thanks for any ideas.
    Last edited by betterthan74; 09-06-2012 at 03:42 PM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    How can you have 3 holidays on the same date?

    Start with this query that will show Daily data if date is a holiday:
    SELECT Daily.ID, Daily.Date, Daily.jobcode, Daily.[Hours Worked], IIf([jobcode]="Part",[Parttime],[Fulltime]) AS HoursNeeded
    FROM Daily INNER JOIN Holidays ON Daily.Date = Holidays.Begin;

    Note the calculated field that determines how many hours needed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    betterthan74 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    3
    The three holidays on one day was a typo. I've corrected it. Thanks for the call out.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Did you try my query idea? One thing that might make it not workable is holiday with 12 hours crossing midnight. This could mean VBA will be needed.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    betterthan74 is offline Novice
    Windows XP Access 2007
    Join Date
    Sep 2012
    Posts
    3
    I am working on it now.. I actually have 16 job codes, not just 2 and think a case statement might work since each rep can only have one job code on any given year The join was exactly what I was looking for, but I'm not sure how it works out if the rep worked all their required hours on the second day for the holidays that have 2 days. As long as they meet the total requirement it doesn't matter. I tried to use two joins but keep creating an ambigious join that way. Your SQl did make me understand that I need to include in my final report all of the holidays from the holidays table and then only the dates that the rep worked from the staffing table that match either the beginning or end date of the holiday. I wrecked the formatting of my answer when I went to edit it. Let me know if there is a way to restore it.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,626
    Not important now but could maybe fix the post in the Advanced post editor. There is a tables tool bar.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. database worked yesterday and not today
    By ctbrown4 in forum Database Design
    Replies: 2
    Last Post: 08-17-2012, 08:43 AM
  2. Employee info in Payroll form
    By ismalee in forum Forms
    Replies: 4
    Last Post: 06-30-2012, 05:16 PM
  3. calculate rate * hours worked
    By hamish mather in forum Queries
    Replies: 1
    Last Post: 12-22-2011, 06:14 AM
  4. Sum hours worked, grouped by dep't
    By goodfood in forum Queries
    Replies: 3
    Last Post: 05-05-2011, 06:11 AM
  5. Access 2010 fails where 2007 worked
    By dick in forum Access
    Replies: 3
    Last Post: 10-16-2010, 01:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums