Results 1 to 3 of 3
  1. #1
    rkalapura is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    New York
    Posts
    69

    Dsum() Function

    Hai,

    I am using the following Dsum function to get the total personel time hours used by each employee. It works well with the selected year like 2010, 2011, 2012 etc.



    DSum("[hoursused]","[annual vacasion]","[EMPLOYEEID]=" & [Forms]![Employee Details]![EmployeeID] & " And Year([startdate])=" & [Forms]![Employee Details]![YearSelect])

    But in our office records, year starts from July 01, and eds at June 30 every year. So I need to change my second criteria to select record in between two dates (ie. like "between [yearstart] and [yearends]"). Is it possible to change the second criteria to between two dates in Dsum() function or any other input to sort this out? I have already these date fileds available in the form.

    Appreciate your help

    Thank you

  2. #2
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    DSum("[hoursused]","[annual vacasion]","[EMPLOYEEID]=" & [Forms]![Employee Details]![EmployeeID] & " And [startdate] between #" & cdate("7/1/" & [Forms]![Employee Details]![YearSelect] -1) & "# and #" & cdate("6/30/" & [Forms]![Employee Details]![YearSelect]) & "#")

    I haven't tested so the parentheses might be off.

    Basically you can keep your same setup so let's say your FY 2012 goes from 7/1/2011 through 6/30/2012 you can keep your year selection and just perform a change to date (cdate) function based on the selected year.

  3. #3
    rkalapura is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jul 2011
    Location
    New York
    Posts
    69
    Thank you very much. It works fine.

    God Bless You!

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

Similar Threads

  1. Dsum() function
    By rkalapura in forum Forms
    Replies: 3
    Last Post: 10-10-2012, 10:06 PM
  2. Problem in Query and DSUM function
    By simplefahad2005 in forum Access
    Replies: 3
    Last Post: 07-27-2012, 12:46 AM
  3. Dsum Help?
    By Ragin_roider in forum Queries
    Replies: 5
    Last Post: 03-19-2012, 03:10 PM
  4. How do I use the DSum
    By Ironclaw in forum Access
    Replies: 1
    Last Post: 08-25-2010, 07:35 AM
  5. Help with dsum
    By bjsbrown in forum Reports
    Replies: 6
    Last Post: 02-06-2010, 09:33 AM

Tags for this Thread

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