AFAIK, SQL doesn't have a case statement, but I am far from being a SQL wizard or even advanced user.
My solution is to write a custom (VBA) function.
Create a new standard module. Name it something like 'MyFunctions".
Paste in the following code:
Code:
Function Get_EOP(pEmpStartDate As Date) As String
'get end of probation date
Dim eopYear As Integer
Dim eopMonth As Integer
If Month(pEmpStartDate) > 9 And Day(pEmpStartDate) >= 2 Then
eopYear = Year(pEmpStartDate) + 1
ElseIf Month(pEmpStartDate) < 10 Then
eopYear = Year(pEmpStartDate)
Else
eopYear = Year(pEmpStartDate) + 1
End If
If Month(pEmpStartDate) + 3 >= 12 And Day(pEmpStartDate) >= 2 Then
eopMonth = Month(pEmpStartDate) + 3 - 12
ElseIf Month(pEmpStartDate) + 3 < 13 And Day(pEmpStartDate) >= 2 Then
eopMonth = Month(pEmpStartDate) + 3
ElseIf Month(pEmpStartDate) + 2 >= 12 And Day(pEmpStartDate) = 1 Then
eopMonth = Month(pEmpStartDate) + 2 - 12
ElseIf Month(pEmpStartDate) + 2 < 13 And Day(pEmpStartDate) = 1 Then
eopMonth = Month(pEmpStartDate) + 2
End If
Get_EOP = Format(CStr(DateSerial(eopYear, eopMonth, 1)), "mm/dd/yyyy")
End Function
The SQL statemnet would be:
Code:
Select MyTable.*, GetEOP([Employee_Start_Date]) as Indicator From MyTable
The VBA could be cleaned up... I tried to match what you have in the SQL to get it to return the same values.