Chintsapete
Registered User.
- Local time
- Today, 02:12
- Joined
- Jun 15, 2012
- Messages
- 137
I'm not quite sure why below doesn't work. I have a form where the [DateOfTermination] is blank until the guys leave the company. Then I'll input the date. Once the date is in it should use [DateOfTermination] as EndDate to determent how many years they worked for us when they quit, else it should use today's date. For some reason if the field is blank it always uses 00:00:00.
Thanks for any help
Pete
Code:
Public Function fnYearsEmployed(DateOfEngagment _
, DateOfTermination)
Dim YearsEmployed As Integer
Dim EndDate As Date
If DateOfTermination Is Not Null Then
EndDate = DateOfTermination
Else
EndDate = Date
End If
YearsEmployed = Nz(Int((DateDiff("yyyy", DateOfEngagment, EndDate))))
fnYearsEmployed = YearsEmployed
End Function
Thanks for any help
Pete