PC Review


Reply
Thread Tools Rate Thread

convert the number to Arabic word

 
 
Yousoft
Guest
Posts: n/a
 
      15th Jun 2009
I prepared module for spellnumber to convert the number to Arabic words, so
when I view the module It is showing me unreadable letter in report or
query,. Please help
thanks
 
Reply With Quote
 
 
 
 
John W. Vinson
Guest
Posts: n/a
 
      15th Jun 2009
On Mon, 15 Jun 2009 07:42:37 -0700, Yousoft
<(E-Mail Removed)> wrote:

>I prepared module for spellnumber to convert the number to Arabic words, so
>when I view the module It is showing me unreadable letter in report or
>query,. Please help
>thanks

Please post your code and the actual error message.
--

John W. Vinson [MVP]
 
Reply With Quote
 
 
 
 
Yousoft
Guest
Posts: n/a
 
      16th Jun 2009
Function SpellNumber(ByVal MyNumber)
Dim Dollars, Cents, Temp
Dim DecimalPlace, Count

ReDim Place(9) As String
Place(2) = " ÃáÝ "
Place(3) = " ãá*æä "
Place(4) = " Billion "
Place(5) = " Trillion "

' String representation of amount
MyNumber = Trim(Str(MyNumber))

' Position of decimal place 0 if none
DecimalPlace = InStr(MyNumber, ".")
'Convert cents and set MyNumber to dollar amount
If DecimalPlace > 0 Then
Cents = GetTens(Left(Mid(MyNumber, DecimalPlace + 1) & "00", 2))
MyNumber = Trim(Left(MyNumber, DecimalPlace - 1))
End If

Count = 1
Do While MyNumber <> ""
Temp = GetHundreds(Right(MyNumber, 3))
If Temp <> "" And Len(MyNumber) > 3 Then
Dollars = "æ " & Temp & Place(Count) & Dollars
ElseIf Temp <> "" And Len(MyNumber) <= 3 Then
Dollars = Temp & Place(Count) & Dollars
End If
If Len(MyNumber) > 3 Then
MyNumber = Left(MyNumber, Len(MyNumber) - 3)
Else
MyNumber = ""
End If
Count = Count + 1
Loop

Select Case Dollars
Case ""
Dollars = "ÕÝÑ ÏÑåã "
Case "One"
Dollars = "ÏÑåã æÇÍÏ æ"
Case Else
Dollars = Dollars & " ÏÑåã "
End Select

Select Case Cents
Case ""
Cents = " æ ÕÝÑ ÝáÓ "
Case "One"
Cents = " æ ÝáÓ æÇÍÏ "
Case Else
'Cents = " æ " & Cents & " ÝáÓ "
Cents = " æ " & Cents & " ÝáÓ "
End Select

SpellNumber = Dollars & Cents
End Function

'*******************************************
' Converts a number from 100-999 into text *
'*******************************************
Function GetHundreds(ByVal MyNumber)
Dim Result As String

If Val(MyNumber) = 0 Then Exit Function
MyNumber = Right("000" & MyNumber, 3)

'Convert the hundreds place
If Mid(MyNumber, 2, 2) <> "00" Then
Select Case Mid(MyNumber, 1, 1)
Case "0"
Result = Result
Case "1"
Result = " ãÇÆÉ æ "
Case "2"
Result = " ãÆÊÇä æ "
Case Else
Result = GetDigit(Mid(MyNumber, 1, 1)) & " ãÇÆÉ æ "
End Select
Else
Select Case Mid(MyNumber, 1, 1)
Case "0"
Result = Result
Case "1"
Result = " ãÇÆÉ "
Case "2"
Result = " ãÆÊÇä "
Case Else
Result = GetDigit(Mid(MyNumber, 1, 1)) & " ãÇÆÉ "
End Select
End If
'-------------------------
' If Mid(MyNumber, 1, 1) = "1" Then
' Result = " ãÇÆÉ "
' ElseIf Mid(MyNumber, 1, 1) <> "0" Then
' Result = GetDigit(Mid(MyNumber, 1, 1)) & " ãÇÆÉ "
' End If


'Convert the tens and ones place
If Mid(MyNumber, 2, 1) <> "0" Then
Result = Result & GetTens(Mid(MyNumber, 2))
Else
Result = Result & GetDigit(Mid(MyNumber, 3))
End If

'-------------------------------------
' If Mid(MyNumber, 2, 1) <> "0" Then
' Result = Result & GetTens(Mid(MyNumber, 2))
' Else
' Result = Result & " æ " & GetDigit(Mid(MyNumber, 3))
' End If


GetHundreds = Result
End Function

'*********************************************
' Converts a number from 10 to 99 into text. *
'*********************************************
Function GetTens(TensText)
Dim Result As String

Result = "" 'null out the temporary function value
If Val(Left(TensText, 1)) = 1 Then ' If value between 10-19
Select Case Val(TensText)
Case 10: Result = "ÚÔÑÉ"
Case 11: Result = "ÃÍÏ ÚÔÑÉ"
Case 12: Result = "ÅËäÇ ÚÔÑÉ"
Case 13: Result = "ËáÇËÉ ÚÔÑÉ"
Case 14: Result = "ÃÑÈÚÉ ÚÔÑÉ"
Case 15: Result = "ÎãÓÉ ÚÔÑÉ"
Case 16: Result = "ÓÊÉ ÚÔÑÉ"
Case 17: Result = "ÓÈÚÉ ÚÔÑÉ"
Case 18: Result = "ËãÇä*É ÚÔÑÉ"
Case 19: Result = "ÊÓÚÉ ÚÔÑÉ"
Case Else
End Select
Else ' If value between 20-99
Select Case Val(Left(TensText, 1))
Case 2: Result = "ÚÔÑæä "
Case 3: Result = "臂辊 "
Case 4: Result = "ÇÑÈÚæä "
Case 5: Result = "ÎãÓæä "
Case 6: Result = "ÓÊæä "
Case 7: Result = "ÓÈÚæä "
Case 8: Result = "ËãÇäæä "
Case 9: Result = "ÊÓÚæä "
Case Else
End Select
Dim r
r = ""
r = GetDigit(Right(TensText, 1))
If Val(Left(TensText, 1)) = 0 Then
Result = r & Result
Else
If r <> "" Then
Result = r & " æ " & Result 'Retrieve ones place
Else
Result = Result
End If
End If
End If
GetTens = Result
End Function

'*******************************************
' Converts a number from 1 to 9 into text. *
'*******************************************
Function GetDigit(Digit)
Select Case Val(Digit)
Case 1: GetDigit = "æÇÍÏ"
Case 2: GetDigit = "ÅËäÇä"
Case 3: GetDigit = "ËáÇËÉ"
Case 4: GetDigit = "ÃÑÈÚÉ"
Case 5: GetDigit = "ÎãÓÉ"
Case 6: GetDigit = "ÓÊÉ"
Case 7: GetDigit = "ÓÈÚÉ"
Case 8: GetDigit = "ËãÇä*É"
Case 9: GetDigit = "ÊÓÚÉ"
Case Else: GetDigit = ""
End Select
End Function



"John W. Vinson" wrote:

> On Mon, 15 Jun 2009 07:42:37 -0700, Yousoft
> <(E-Mail Removed)> wrote:
>
> >I prepared module for spellnumber to convert the number to Arabic words, so
> >when I view the module It is showing me unreadable letter in report or
> >query,. Please help
> >thanks

> Please post your code and the actual error message.
> --
>
> John W. Vinson [MVP]
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to use Arabic diacritics in writing arabic ligatures mohammed T Shoukry Microsoft Word Document Management 1 17th Dec 2009 04:15 PM
Table of Contents in Roman and Arabic Numbers only want Arabic Num Keith Brown Microsoft Word Document Management 3 29th Apr 2009 04:21 AM
English - Arabic and Arabic - English Date Mel Microsoft Excel Misc 0 16th Jan 2008 06:41 PM
Problems in Arabic writing when I use word 2003 Arabic Enabeled. =?Utf-8?B?WmF5ZDgy?= Microsoft Word Document Management 0 19th Sep 2004 11:15 PM
The Arabic Character in ASP file read from access database contain arabic data =?Utf-8?B?QWhtZWQgTSBSYWFmYXQ=?= Microsoft Access 0 19th Feb 2004 07:41 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:36 AM.