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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

whats wrong with this code?? WHY...WHY...WHY!!!!!!

Status
Not open for further replies.

chryso

Programmer
Apr 25, 2001
2
0
0
GB
Hi guys....
could any one please tell me why this prodedure doesn't work properly.
e.g. if i enter a value that is <=1180, instead of calculating the tax at
10%, it does it a t 20%. if i enter a value over 29400, it calculates the
tax at 10% instead of 40% etc.....WHY...WHY...WHY!!!!!!

Thanxs Chryso

<%
Sub PaidTaxToDate (ByRef TaxTD)
Select Case TaxTD
Case MyAcctTaxPayTD <= 1880
TaxTD = (FormatCurrency(MyAcctTaxPayTD/100)*BR)
Case MyAcctTaxPayTD > 1880 AND MyAcctTaxPayTD < 29401
TaxTD = (FormatCurrency(MyAcctTaxPayTD/100)*SR)
Case MyAcctTaxPayTD > 29400
TaxTD = (FormatCurrency(MyAcctTaxPayTD/100)*HR)
End Select
Call StoreTaxTD(TaxTD)
End Sub

Sub StoreTaxTD(AcctTaxTD)
Response.write &quot;<BR> Your Tax Paid to Date is &quot; &AcctTaxTD
End Sub
%>
 
i suppose the tax rate is stored in BR/SR/HR.
The calculations are wrong, so their values at runtime are suspect.
Check the values on run time. br
Gerard
(-:

Better a known bug then a new release.
 
Here is what I believe your Select Case says:
Code:
If Taxtd = (MyAcctTaxPayTD <= 1880) then ' True or False 
            TaxTD = (FormatCurrency(MyAcctTaxPayTD/100)*BR)
elseif TaxTD = (MyAcctTaxPayTD > 1880 AND MyAcctTaxPayTD < 29401) then 
            TaxTD = (FormatCurrency(MyAcctTaxPayTD/100)*SR)
elseif Taxtd = (MyAcctTaxPayTD > 29400) then  
            TaxTD = (FormatCurrency(MyAcctTaxPayTD/100)*HR)
End if
I don't know what you want to do but I doubt that this will do it.
 
why don't you use :

select case true
case.....
....

 
if MyAcctTaxPayTD <= 1880 then
TaxTD = (FormatCurrency(MyAcctTaxPayTD/100)*BR)
elseif MyAcctTaxPayTD > 1880 AND MyAcctTaxPayTD < 29401 then
TaxTD = (FormatCurrency(MyAcctTaxPayTD/100)*SR)
elsif MyAcctTaxPayTD > 29400 then
TaxTD = (FormatCurrency(MyAcctTaxPayTD/100)*HR)
end if


? br
Gerard
(-:

Better a known bug then a new release.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top