G
Guest
I am attempting to use a Select Case statement in a public function within a
Select query to return the result of a formula to determine profitability.
Here is a sample of the code. It is not returning any results.
Public Function Gain()
Dim Investor As Variant
Dim OrigFee As Field
Dim DiscPts As Field
Dim InvYSP As Field
Dim LoanAmt As Field
Select Case Investor
Case "GMAC Bank"
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 35.5
Case "Countrywide Correspondent"
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 6.5
Case "Washington Mutual Bank, FA"
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 40
Case "Ohio Savings Bank"
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 190
Case "Option One Mortgage"
If [LoanAmt] > 130000 Then
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 200
Else
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 335
End If
End Select
End Function
I have tried using IIf however with the amount of "Investors", I need more
nesting ability.
Thanks for your help...
Select query to return the result of a formula to determine profitability.
Here is a sample of the code. It is not returning any results.
Public Function Gain()
Dim Investor As Variant
Dim OrigFee As Field
Dim DiscPts As Field
Dim InvYSP As Field
Dim LoanAmt As Field
Select Case Investor
Case "GMAC Bank"
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 35.5
Case "Countrywide Correspondent"
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 6.5
Case "Washington Mutual Bank, FA"
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 40
Case "Ohio Savings Bank"
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 190
Case "Option One Mortgage"
If [LoanAmt] > 130000 Then
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 200
Else
Gain = [OrigFee] + [DiscPts] + [InvYSP] + 335
End If
End Select
End Function
I have tried using IIf however with the amount of "Investors", I need more
nesting ability.
Thanks for your help...