By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,255 Members | 2,717 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,255 IT Pros & Developers. It's quick & easy.

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

P: 7
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?
Jun 4 '07 #1
Share this Question
Share on Google+
2 Replies


JConsulting
Expert 100+
P: 603
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?
Jun 4 '07 #2

FishVal
Expert 2.5K+
P: 2,653
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(dteRangeStart 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(dteEnd) Then
dteEnd = dteRangeEnd
Else
If dteRangeEnd < dteEnd Then dteEnd = dteRangeEnd
End If

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

End Function
Jun 4 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.