Results 1 to 2 of 2
  1. #1
    robmay is offline Novice
    Windows XP Access 2000
    Join Date
    Apr 2013
    Posts
    1

    Multiple date ranges in the same pay report

    Alright, so I've got an Access 2000 database linking to an Excel 2000 sheet with date, name, hours worked, overtime hours, and penalties (in dollars). So far I've made a nice form where you select a date range and a name and you can generate a report that shows the employee's total hours, OT hours, OT%, etc. I linked this to a table in Access that has hourly wages, and included total pay in the report. Everything's good here.

    What I need now is a report that shows all of this data per pay cycle. This means choosing a payday and showing regular hours from the previous two weeks and OT hours from the two weeks prior to that. For example, if you entered 2/22/13 as the pay date, the report would show the total hours and costs for regular hours worked from 2/1/13 to 2/15/13 and OT hours worked from 1/18/13 to 2/1/13. I made text boxes in the form that automatically fill in the dates of each range, so I can reference them later.

    So far I've tried two things. First, I used an IIF sum statement in a text box in the report itself: =Sum(IIf([Date]=Between [Forms]![FRM_PayDate]![Reg_Start] and [Forms]![FRM_PayDate]![Reg_End],[Reg_Hours],0)). I tried this with and without quotes around the Between statement, to no avail. Not sure if it's possible to use a Between statement like that, or at all inside an IIF.

    Next, I tried making a few queries. One contains only the regular hour date range and daily hour counts, another contains only the OT hour date range and daily hour counts, and a third joins the two of those to the original data via joining [Name] and [Date] on all three, but this confusingly only showed me the data for the date 2/1/13. I'm thinking it's because it's the only common date in all three...

    I should clarify, I realize I can sum things up in separate queries and just output the totals, but the good thing about the reports I have now is I can go in and change the "Detail" section to Visible, and get a detailed rundown of the numbers instead of just a sum. I'd like this to be the case with the new report as well.

    I'm relatively new to Access and totally lost. I don't know much VB coding, but I'm open to trying to learn. Any ideas? I know that's a lot of information at once, so please don't hesitate to ask questions if you have them. Thanks!
    Last edited by robmay; 04-05-2013 at 11:55 AM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,623
    BETWEEN AND only works in queries. Otherwise use =>, <=.

    =Sum(IIf([Date]=> [Forms]![FRM_PayDate]![Reg_Start] and [Date]<= [Forms]![FRM_PayDate]![Reg_End],[Reg_Hours],0))
    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. How to Program Two Date Ranges?
    By Jaynen in forum Database Design
    Replies: 5
    Last Post: 02-22-2013, 06:58 AM
  2. How to Compare Two Date Ranges?
    By Jaynen in forum Access
    Replies: 1
    Last Post: 02-19-2013, 05:26 PM
  3. Multiple date ranges on report
    By AAA in forum Reports
    Replies: 1
    Last Post: 06-18-2012, 10:18 PM
  4. Searching for Date Ranges
    By phd42122 in forum Access
    Replies: 2
    Last Post: 05-07-2012, 07:20 AM
  5. Replies: 1
    Last Post: 01-10-2012, 10:12 PM

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