What is wrong with my Select Case?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

The following code does not work I do not know why. the number that I am
checking is "0.00338076308652524" which is < 1 but I am not getting the
result which is " less than" in the text box "RF34d" (RF34d =
NumbertoLetters(RF34c))
any idea?
thanks




***********************************************
Private Function NumbertoLetters(numTolet As Integer) As String

Select Case Format(numTolet, "##")
Case Is < 1
NumbertoLetters = " less than"
end select
end function
**********************************************
 
Al,

The format function converts your number to a string, so your comparison
compares the text string to a number. Also, in your format declaration
statement, you have defined numTolet as an integer, but are passing a single
or double. This should not be the problem, but I would change it anyway.
***********************************************
Private Function NumbertoLetters(numTolet As Integer) As String

Select Case numTolet
Case Is < 1
NumbertoLetters = " less than"
end select
end function
**********************************************

HTH
Dale
 
Yes, you are right. It worked, thanks
Al

Dale Fye said:
Al,

The format function converts your number to a string, so your comparison
compares the text string to a number. Also, in your format declaration
statement, you have defined numTolet as an integer, but are passing a single
or double. This should not be the problem, but I would change it anyway.


HTH
Dale
 
Back
Top