I am new to VB6 so please bear with me. I have to take the date a salesman started and see if they have worked for 24 months yet. BUT! If they start after January of a given year, they are to be considered as having started January 1 of the following year. For example: I started 1 February 2006, I need my comparison date to become 1 January 2007.
What I have done so far works, but it is extremely ugly. I would like a more elegant way to accomplish this.
Here is my code so far:
Code:
Dim tempmonth As String
Dim comparedate As String
tempmonth = Month(rsAgtRateUpdate![Fin Date])
If tempmonth <> 1 Then
comparedate = "1/1/" & (Year(rsAgtRateUpdate![Fin Date]) + 1)
Else
comparedate = rsAgtRateUpdate![Fin Date]
End If
'If the difference between the start date and the compare date is less than 24 months, it's a new hire
If DateDiff("m", DateValue(comparedate), xBegDate) < 24 Then
rsAgtRateUpdate!AgtFlag = "2"
Else
rsAgtRateUpdate!AgtFlag = "1"
End If
I thank you in advance.