I have a textbox (txtJobStartDate).
In order to calculate the amount of time the employee has been employed, i have another text box (txtYearsWorked) with the following control source:
=(DateDiff("y",[txtJobStartDate],[Date]()))/365
This gives me the amount of time worked as a decimal figure.
I then need to calculate whether today is an anniversary of the start date, so I need to check whether txtYearsWorked is a whole number. To do this, I have the following code in the OnCurrent section of the form:
Dim YearsWorkedWhole As Integer
Dim Remainder As Double
YearsWorkedWhole = CInt(Me.txtYearsWorked)
Remainder = Me.txtYearsWorked - YearsWorkedWhole
If Remainder = 0 Then
DoCmd.OpenForm "frmLengthOfEmploymentReminder"
End If
This works perfectly for 2000, 2001, 2002, but it doesn't work for 1999, 1998, etc.
For example
If txtJobStartDate = 24/09/00 Then txtYearsWorked = 3,
but if txtJobStartDate = 24/09/99 Then txtYearsWorked = 4.0027397260274 instead of 4.
Any ideas????
In order to calculate the amount of time the employee has been employed, i have another text box (txtYearsWorked) with the following control source:
=(DateDiff("y",[txtJobStartDate],[Date]()))/365
This gives me the amount of time worked as a decimal figure.
I then need to calculate whether today is an anniversary of the start date, so I need to check whether txtYearsWorked is a whole number. To do this, I have the following code in the OnCurrent section of the form:
Dim YearsWorkedWhole As Integer
Dim Remainder As Double
YearsWorkedWhole = CInt(Me.txtYearsWorked)
Remainder = Me.txtYearsWorked - YearsWorkedWhole
If Remainder = 0 Then
DoCmd.OpenForm "frmLengthOfEmploymentReminder"
End If
This works perfectly for 2000, 2001, 2002, but it doesn't work for 1999, 1998, etc.
For example
If txtJobStartDate = 24/09/00 Then txtYearsWorked = 3,
but if txtJobStartDate = 24/09/99 Then txtYearsWorked = 4.0027397260274 instead of 4.
Any ideas????