Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Could use some help with this Function 1

Status
Not open for further replies.

penndro

Technical User
Jan 9, 2005
108
US
I am running this function in a query and I am getting zeros as the result which is not correct in all instances. Can you take a look and give me your opinion on the code:

Public Function GetEESSI(YTDSS As Double, EstTax As Double) As Double

Dim SSIMaxPay As Double
Dim SSIEeBasis As Double

SSIMaxPay = 4624.2
SSIEeBasis = 0.042

If YTDSS >= SSIMaxPay Then
GetESSI = 0
ElseIf ([EstTax] * [SSIEeBasis]) + YTDSS > SSIMaxPay Then
GetESSI = [SSIMaxPay] - [YTDSS]
Else
GetESSI = [EstTax] * [SSIEeBasis]
End If
End Function

Thanks
 
Public Function GetEESSI(YTDSS As Double, EstTax As Double) As Double

Dim SSIMaxPay As Double
Dim SSIEeBasis As Double

SSIMaxPay = 4624.2
SSIEeBasis = 0.042

If YTDSS >= SSIMaxPay Then
Get[!]E[/!]ESSI = 0
ElseIf ([EstTax] * [SSIEeBasis]) + YTDSS > SSIMaxPay Then
Get[!]E[/!]ESSI = [SSIMaxPay] - [YTDSS]
Else
Get[!]E[/!]ESSI = [EstTax] * [SSIEeBasis]
End If
End Function

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Use Option Explicit in VB. Look in Tools > Options -- Editor Tab -- Require Variable Declaration.

Skip,

[glasses]Just traded in my old subtlety...
for a NUANCE![tongue]
 
Ok, wow I feel stupid.

Thanks you both. Had a long partying weekend.

Appreciated.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top