Gustav Brock
gustav at cactus.dk
Tue Apr 27 03:52:22 CDT 2004
Hi Darren DateDiff("y", ..) - or rather DateDiff("d", ..) - returns a number of days. That is not a date. If you wish a difference in months, use DateDiff("m", ..). However, that will return one month even if the first date is the last day of one month and the second date is the first day of the next month. If you need the count of full months, I have a function which does that. /gustav > Can anyone tell me why dtTimeElapsed is returning a crap date around 1900 or so? > dtStartDate returns the expected date as does dtTodaysDate > Many thanks > Darren > Dim dtStartDate As Date > Dim dtTodaysDate As Date > Dim dtTimeElapsed As Date > dtStartDate = DLookup("[EnrolmentDate]", "tblStudentAwardAllocations", "[AwardID] = " _ > & Forms!frmStudents!cmbAwards) > dtTodaysDate = Date > dtTimeElapsed = Format(DateDiff("y", [dtTodaysDate], [dtStartDate]), "m") > MsgBox "EnrolDate = " & dtStartDate & vbCrLf _ > & "Today = " & dtTodaysDate & vbCrLf _ > & "elapsed = " & dtTimeElapsed