How to convert 100 to One Hundred

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

Guest

Is there any function to convert numeric to text

For example: 1110 one thousand one hundred and ten.
 
I do not know what version you are running but this came from 97 and was converted to 2000. It has been working great for years

Option Compare Databas
Option Explici

'Variables used in NumWord() procedure declared here
Dim EngNum(90) As Strin
Dim StringNum As String, Chunk As String, English As Strin
Dim Pennies As Strin

Dim Hundreds As Integer, Tens As Integer, Ones As Intege
Dim LoopCount As Integer, StartVal As Intege
Dim TensDone As Intege

_______________________________________

Static Function NumWord(ByVal AmountPassed As Currency) As Strin
'** Convert a number to words for filling in the Amount of a chec
'** Example: NumWord(120.45) returns ONE HUNDRED TWENTY AND 45/10
'** Can handle numbers from 0 to $999,999.99. Created by Alan Simpso

'** The array below, and other variables, are dimensione
'** in the Declarations section
If Not EngNum(1) = "One" The
EngNum(0) = "
EngNum(1) = "One
EngNum(2) = "Two
EngNum(3) = "Three
EngNum(4) = "Four
EngNum(5) = "Five
EngNum(6) = "Six
EngNum(7) = "Seven
EngNum(8) = "Eight
EngNum(9) = "Nine
EngNum(10) = "Ten
EngNum(11) = "Eleven
EngNum(12) = "Twelve
EngNum(13) = "Thirteen
EngNum(14) = "Fourteen
EngNum(15) = "Fifteen
EngNum(16) = "Sixteen
EngNum(17) = "Seventeen
EngNum(18) = "Eighteen
EngNum(19) = "Nineteen
EngNum(20) = "Twenty
EngNum(30) = "Thirty
EngNum(40) = "Forty
EngNum(50) = "Fifty
EngNum(60) = "Sixty
EngNum(70) = "Seventy
EngNum(80) = "Eighty
EngNum(90) = "Ninety
End I

'** Convert incoming Currency value to a string for parsing
StringNum = Format$(AmountPassed, "000000.00"

'** Initialize other variable
English = "
LoopCount =
StartVal =
Pennies = Mid$(StringNum, 8, 2

'** If amount passed is 0 just return "Zero"..
If AmountPassed = 0 The
NumWord = "Zero
Exit Functio
End I

'** Now do each 3-digit section of number
While LoopCount <=
Chunk = Mid$(StringNum, StartVal, 3
Hundreds = VAL(Mid$(Chunk, 1, 1)
Tens = VAL(Mid$(Chunk, 2, 2)
Ones = VAL(Mid$(Chunk, 3, 1)

'** Do the hundreds portion of 3-digit numbe
If VAL(Chunk) > 99 The
English = English & EngNum(Hundreds) & " Hundred
End I

'** Do the tens & ones portion of 3-digit numbe
TensDone = Fals
'** Is it less than 10
If Tens < 10 The
English = English & " " & EngNum(Ones
TensDone = Tru
End I

'** Is it a teen
If (Tens >= 11 And Tens <= 19) The
English = English & EngNum(Tens
TensDone = Tru
End I

'** Is it Evenly Divisible by 10
If (Tens / 10#) = Int(Tens / 10#) The
English = English & EngNum(Tens
TensDone = Tru
End I

'** Or is it none of the above
If Not TensDone The
English = English & EngNum((Int(Tens / 10)) * 10
English = English & " " & EngNum(Ones
End I

'** Add the word "thousand" if necessary
If AmountPassed > 999.99 And LoopCount = 1 The
English = English + " Thousand
End I

'** Do pass through second three digit
LoopCount = LoopCount +
StartVal =
Wen

'** Done: Return english with pennies tacked on
NumWord = Trim(English) & " and " & Pennies & "/100

End Functio

----- (e-mail address removed) wrote: ----

Is there any function to convert numeric to tex

For example: 1110 one thousand one hundred and ten
 
Back
Top