in a textbox I write 100000. I want another text show automatically
"one lac". I mean it aumatically show the in word of that numeric number what I write. how it possible.

you want to show the equivalent value of the number you type, for example: you entered 1000 then there would be a display of one thousand or what?

wow, debasisdas.. two thumbs up for you.. :)

## All 7 Replies

you want to show the equivalent value of the number you type, for example: you entered 1000 then there would be a display of one thousand or what?

try this sample function for the job.

``````Code:
Public Function NumToWord(numstr As Variant) As String

Dim newstr As String

numstr = CDec(numstr)

If numstr = 0 Then
NumToWord = "Zero"
Exit Function
End If

If numstr > 10 ^ 24 Then
NumToWord = "Number too big"
Exit Function
End If

If numstr >= 10 ^ 12 Then
newstr = NumToWord(Int(numstr / 10 ^ 12))
numstr = ((numstr / 10 ^ 12) - _
Int(numstr / 10 ^ 12)) * 10 ^ 12
If numstr = 0 Then
tempstr = tempstr & newstr & "Bilion "
Else
tempstr = tempstr & newstr & "Bilion "
End If
End If

If numstr >= 10 ^ 6 Then
newstr = NumToWord(Int(numstr / 10 ^ 6))
numstr = ((numstr / 10 ^ 6) - _
Int(numstr / 10 ^ 6)) * 10 ^ 6
If numstr = 0 Then
tempstr = tempstr & newstr & "milion "
Else
tempstr = tempstr & newstr & "milion "
End If
End If

If numstr >= 10 ^ 3 Then ' thousand
newstr = NumToWord(Int(numstr / 10 ^ 3))
numstr = ((numstr / 10 ^ 3) - Int(numstr / 10 ^ 3)) * 10 ^ 3
If numstr = 0 Then
tempstr = tempstr & newstr & "thousand "
Else
tempstr = tempstr & newstr & "thousand "
End If
End If

If numstr >= 10 ^ 2 Then
newstr = NumToWord(Int(numstr / 10 ^ 2))
numstr = ((numstr / 10 ^ 2) - Int(numstr / 10 ^ 2)) * 10 ^ 2
If numstr = 0 Then
tempstr = tempstr & newstr & "hundred "
Else
tempstr = tempstr & newstr & "hundred "
End If
End If

If numstr >= 20 Then
Select Case Int(numstr / 10)
Case 2
tempstr = tempstr & "twenty "
Case 3
tempstr = tempstr & "thirty "
Case 4
tempstr = tempstr & "forty "
Case 5
tempstr = tempstr & "fifty "
Case 6
tempstr = tempstr & "sixty "
Case 7
tempstr = tempstr & "seventy "
Case 8
tempstr = tempstr & "eighty "
Case 9
tempstr = tempstr & "ninety "
End Select
numstr = ((numstr / 10) - Int(numstr / 10)) * 10
End If

If numstr > 0 Then
Select Case numstr
Case 1
tempstr = tempstr & "one "
Case 2
tempstr = tempstr & "two "
Case 3
tempstr = tempstr & "three "
Case 4
tempstr = tempstr & "four "
Case 5
tempstr = tempstr & "five "
Case 6
tempstr = tempstr & "six "
Case 7
tempstr = tempstr & "seven "
Case 8
tempstr = tempstr & "eight "
Case 9
tempstr = tempstr & "nine "
Case 10
tempstr = tempstr & "ten "
Case 11
tempstr = tempstr & "eleven "
Case 12
tempstr = tempstr & "twelve "
Case 13
tempstr = tempstr & "thirteen "
Case 14
tempstr = tempstr & "fourteen "
Case 15
tempstr = tempstr & "fifteen "
Case 16
tempstr = tempstr & "sixteen "
Case 17
tempstr = tempstr & "seventeen "
Case 18
tempstr = tempstr & "eighteen "
Case 19
tempstr = tempstr & "nineteen "
End Select
numstr = ((numstr / 10) - Int(numstr / 10)) * 10
End If

NumToWord = tempstr
End Function``````

if using oracle as database you can easily do it by creating a simple function in database.

wow, debasisdas.. two thumbs up for you.. :)

debasis can you help me more.
where I use this code. you make a function. and I mean where I will call it?

hi abu taher, it's a function so you can use like this..

if you're input let's say from text1.text

``Msgbox numtoword (text1.text)``

try this sample function for the job.

``````Code:
Public Function NumToWord(numstr As Variant) As String

Dim newstr As String

numstr = CDec(numstr)

If numstr = 0 Then
NumToWord = "Zero"
Exit Function
End If

If numstr > 10 ^ 24 Then
NumToWord = "Number too big"
Exit Function
End If

If numstr >= 10 ^ 12 Then
newstr = NumToWord(Int(numstr / 10 ^ 12))
numstr = ((numstr / 10 ^ 12) - _
Int(numstr / 10 ^ 12)) * 10 ^ 12
If numstr = 0 Then
tempstr = tempstr & newstr & "Bilion "
Else
tempstr = tempstr & newstr & "Bilion "
End If
End If

If numstr >= 10 ^ 6 Then
newstr = NumToWord(Int(numstr / 10 ^ 6))
numstr = ((numstr / 10 ^ 6) - _
Int(numstr / 10 ^ 6)) * 10 ^ 6
If numstr = 0 Then
tempstr = tempstr & newstr & "milion "
Else
tempstr = tempstr & newstr & "milion "
End If
End If

If numstr >= 10 ^ 3 Then ' thousand
newstr = NumToWord(Int(numstr / 10 ^ 3))
numstr = ((numstr / 10 ^ 3) - Int(numstr / 10 ^ 3)) * 10 ^ 3
If numstr = 0 Then
tempstr = tempstr & newstr & "thousand "
Else
tempstr = tempstr & newstr & "thousand "
End If
End If

If numstr >= 10 ^ 2 Then
newstr = NumToWord(Int(numstr / 10 ^ 2))
numstr = ((numstr / 10 ^ 2) - Int(numstr / 10 ^ 2)) * 10 ^ 2
If numstr = 0 Then
tempstr = tempstr & newstr & "hundred "
Else
tempstr = tempstr & newstr & "hundred "
End If
End If

If numstr >= 20 Then
Select Case Int(numstr / 10)
Case 2
tempstr = tempstr & "twenty "
Case 3
tempstr = tempstr & "thirty "
Case 4
tempstr = tempstr & "forty "
Case 5
tempstr = tempstr & "fifty "
Case 6
tempstr = tempstr & "sixty "
Case 7
tempstr = tempstr & "seventy "
Case 8
tempstr = tempstr & "eighty "
Case 9
tempstr = tempstr & "ninety "
End Select
numstr = ((numstr / 10) - Int(numstr / 10)) * 10
End If

If numstr > 0 Then
Select Case numstr
Case 1
tempstr = tempstr & "one "
Case 2
tempstr = tempstr & "two "
Case 3
tempstr = tempstr & "three "
Case 4
tempstr = tempstr & "four "
Case 5
tempstr = tempstr & "five "
Case 6
tempstr = tempstr & "six "
Case 7
tempstr = tempstr & "seven "
Case 8
tempstr = tempstr & "eight "
Case 9
tempstr = tempstr & "nine "
Case 10
tempstr = tempstr & "ten "
Case 11
tempstr = tempstr & "eleven "
Case 12
tempstr = tempstr & "twelve "
Case 13
tempstr = tempstr & "thirteen "
Case 14
tempstr = tempstr & "fourteen "
Case 15
tempstr = tempstr & "fifteen "
Case 16
tempstr = tempstr & "sixteen "
Case 17
tempstr = tempstr & "seventeen "
Case 18
tempstr = tempstr & "eighteen "
Case 19
tempstr = tempstr & "nineteen "
End Select
numstr = ((numstr / 10) - Int(numstr / 10)) * 10
End If

NumToWord = tempstr
End Function``````

if using oracle as database you can easily do it by creating a simple function in database.

can i use this in MS access

Yes you can.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.