All right. Place this VBAS code in a new module in Access:
Code:
Function SpecialDateCalc(FSA_Date As Variant, FSL As Integer) As Date
Dim myTempDate As Date
' If date field is blank, return current date...
If IsNull(FSA_Date) Then
myTempDate = Date
Else
' ... else calculate date based on FSL value
Select Case FSL
Case 1, 2
myTempDate = DateAdd("yyyy", 5, FSA_Date)
Case 3, 4
myTempDate = DateAdd("yyyy", 3, FSA_Date)
Case Else
myTempDate = Date
End Select
End If
' Go to end of month of calculated date
SpecialDateCalc = DateSerial(Year(myTempDate), Month(myTempDate) + 1, 0)
End Function
Now, to use it in any type of calculation (i.e. in a query or VBA), you simply use it like any other native Access functions, i.e. in your query:
MyDateCalc: SpecialDateCalc([FSA_Date], [FSL])