Access 2003, # of days for a given date Range.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ltazz
    New Member
    • May 2007
    • 7

    Access 2003, # of days for a given date Range.

    i need to know how to get a number of days output for the date ranges of 10/1/2006 to 09/30/2007 for individuals with start and stop dates that are either before or after the dates above. i can get the data if the start and stop dates fall between the 2 dates, however a number of them start prior to my start date and or end after my end date.
    any help?
  • JConsulting
    Recognized Expert Contributor
    • Apr 2007
    • 603

    #2
    Originally posted by ltazz
    i need to know how to get a number of days output for the date ranges of 10/1/2006 to 09/30/2007 for individuals with start and stop dates that are either before or after the dates above. i can get the data if the start and stop dates fall between the 2 dates, however a number of them start prior to my start date and or end after my end date.
    any help?
    wow...ok. How about some examples....and how does your Range come into play?

    Comment

    • FishVal
      Recognized Expert Specialist
      • Jun 2007
      • 2656

      #3
      Something like this.

      dteRangeStart, dteRangeEnd - specified range borders
      dteStart, dteEnd - individual start and end, dteEnd may be Null as far as i've got a point

      Public Function DaysOutput(dteR angeStart As Date, _
      dteRangeEnd As Date, _
      dteStart As Date, _
      Optional dteEnd As Variant) As Integer

      If dteRangeStart > dteStart Then dteStart = dteRangeStart
      If IsNull(dteEnd) Or IsMissing(dteEn d) Then
      dteEnd = dteRangeEnd
      Else
      If dteRangeEnd < dteEnd Then dteEnd = dteRangeEnd
      End If

      DaysOutput = DateDiff("d", dteStart, dteEnd)

      End Function

      Comment

      Working...