Right now he has embedded statements, so it would break down to something like:
expression_0: dbrec("curname")<>"EURO"
true_0:
expression_1: dbrec("curvalue")="0"
true_1: "N/A"
false_1: formatnumber(cdbl(dbrec("curvalue")))
false_0: dbrec("curvalue")
There is no built-in protection here for empty strings, NULL values, strings with text in them, etc.
I would suggest writing it out into longer format for maintainability.
A better solution would be:
Code:
If ucase(dbrec("curname)) = "EURO" Then
Response.Write dbrec("curvalue")
ElseIf dbrec("curvalue") = 0 Then
Response.Write "N/A"
ElseIf Not isNumeric(dbrec("curvalue")) Then
Response.Write dbrec("curvalue")
Else
Response.Write FormatNumber(dbrec("curvalue"),4)
End If
Now you are protected against EURO, 0, non-numbers.
If they were truly all numbers except for EURO or 0's (which are numbers) then you wouldn't be getting cDbl errors. My guess is that if they all look like numbers you need to apply a trim statement before the cDbl.
-T
[/code]
01000111 01101111 01110100 00100000 01000011 01101111 01100110 01100110 01100101 01100101 00111111
Need an expensive ASP developer in the North Carolina area?
Feel free to let me know.