Function Outcome2(sTyp As String, sDep As String, iCnt As Integer, nMon As Single, sSta As String, iLen As Integer, nAMT As Currency) As String
Select Case True
Case ChkOutcome30(nAMT)
Outcome2 = "Outcome 30"
Case ChkOutcome01(sTyp, sSta, iLen)
Outcome2 = "Outcome 1"
Case ChkOutcome02(sTyp, sSta, iLen)
Outcome2 = "Outcome 2"
Case ChkOutcome03(sTyp, sDep, iLen)
Outcome2 = "Outcome 3"
' etc.
' finally none of conditions satisfied
Case Else
Outcome2 = "No match"
End Select
End Function
' support functions for criteria 1-3 and 30 (assumed that it is the priority)
' process other criteria in a similar way
Function ChkOutcome01(sTyp As String, sSta As String, iLen As Integer) As Boolean
If sTyp = "Invoice" And sSta = "C" And iLen = 1 Then
ChkOutcome01 = True
Else
ChkOutcome01 = False
End If
End Function
Function ChkOutcome02(sTyp As String, sSta As String, iLen As Integer) As Boolean
If sTyp = "Invoice" And sSta = "E" And iLen = 1 Then
ChkOutcome02 = True
Else
ChkOutcome02 = False
End If
End Function
Function ChkOutcome03(sTyp As String, sDep As String, iLen As Integer) As Boolean
If sTyp = "Invoice" And sDep = "A001" And iLen = 1 Then
ChkOutcome03 = True
Else
ChkOutcome03 = False
End If
End Function
Function ChkOutcome30(nAMT As Currency) As Boolean
If nAMT >= -100 And nAMT <= 100 Then
ChkOutcome30 = True
Else
ChkOutcome30 = False
End If
End Function