Date dif

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a field that I would like to have calculate on the report for the length of employment. Just need a little formatting inf

I currently have the [Start Svc]-[End Svc] this works but prints out in days ie. 230 etc. How do I make it say years, months et

Thanks
 
Check out the DateDiff function in Help.

Note that this doesn't always give the results that you seek (for example,
it calculates the difference in years from 12/31/2003 to 1/1/2004 as one
year).
The expression below (courtesy of Van Dinh, ACCESS MVP) uses DateDiff
function with some extra criteria that "fixes" this:

DateDiff("yyyy", [StartDate], [EndDate] + (Format([StartDate], "mmdd") >
Format([EndDate], "mmdd"))


An alternative date difference function (that you would put into a regular
module as a public function) is found on Douglas Steele's web site (Doug
also is an ACCESS MVP):
http://members.rogers.com/douglas.j.steele/Diff2Dates.html


--
Ken Snell
<MS ACCESS MVP>


René said:
I have a field that I would like to have calculate on the report for the
length of employment. Just need a little formatting info
I currently have the [Start Svc]-[End Svc] this works but prints out in
days ie. 230 etc. How do I make it say years, months etc
 
Back
Top