Code Does Not Work
Put in checks for those conditions
if tb8.Value = "" then
vVal = 0
elseif tb8.Value = 0 then
vVal = 0
elseif isnumeric(tb8.value) then
vVal = cdbl(tb8.value)
else
vVal = 0
End if
or probably better:
if isnumeric(tb8.Value) and tb8.Value < "" then
vVal = cdbl(tb8.Value)
else
vVal = 0
End if
--
Regards,
Tom Ogilvy
"Minitman" wrote in message
...
Hey Tom,
What if instead of a number you have "" sometimes and 0 in others, in
the same TextBox. What do you use then.
-Minitman
On Tue, 14 Dec 2004 21:52:03 -0500, "Tom Ogilvy"
wrote:
Here is why
? val("$8.00")
0
Val stops evaluating at the first non-numeric character. That is why it
didn't work "right" with 8.00%. However, cdbl will accept and ignore the
$,
but will cause an error with "8.00%"
Using cdec is overkill. It uses up 14 bytes to store a value and is
designed for huge numbers. Double (8 bytes) or single (4 bytes) is more
realistic: cdbl or csng
|