Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2006
    Posts
    9

    How to automactically change the currency amount to words ?

    I saw many program they key-in the amount (example : $1,200.00) and it automatically changed it to wording (as example said : One Thousand Two Hundred Only) report.

    How to do that ? thanks.

  2. #2
    StepUP is offline Advanced Beginner
    Windows 7 64bit Access 2000
    Join Date
    Dec 2005
    Posts
    99
    Public Function Currency_2_String(Amount As Double) As String

    Dim dollars As Long
    Dim cents As Long
    Dim cs As Variant

    dollars = Int(Amount)
    cents = (Amount - dollars) * 100
    cs = Trim(Number_2_String(dollars, "")) + (" and " & Format(cents, "00") & "/100")
    Currency_2_String = UCase(Left(cs, 1)) & Mid(cs, 2)

    End Function

    Public Function Number_2_String(num As Long, Optional units As String = "units") As String

    Dim i As Integer

    suffix = Array("", "thousand", "million", "milliard", "Tera", "Peta", "Exa")
    digitName = Array("zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen")
    namety = Array("twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety")
    suffix(0) = units
    i = 0

    If num = 0 Then
    Number_2_String = "and 00/100"
    Else
    Do Until num = 0
    Number_2_String = Small_Number_2_String(num Mod 1000, i) + " " + suffix(i) + " " + Number_2_String
    i = i + 1
    num = num \ 1000
    Loop
    End If

    End Function

  3. #3
    Join Date
    Apr 2006
    Posts
    9
    Thanks for the code you given, actually i am very new to MS Access and newbie to programming.

    I had try to put the code into the code builder, but nothing happen :shock: , can you please explain how its work ? :?: :roll:

    thanks a lot ~~~

  4. #4
    Join Date
    Apr 2006
    Posts
    9
    Quote Originally Posted by Maxzs
    Thanks for the code you given, actually i am very new to MS Access and newbie to programming.

    I had try to put the code into the code builder, but nothing happen :shock: , can you please explain how its work ? :?: :roll:

    thanks a lot ~~~
    ?? :cry:

  5. #5
    StepUP is offline Advanced Beginner
    Windows 7 64bit Access 2000
    Join Date
    Dec 2005
    Posts
    99
    Put the code in a module.

    Then use the Currency_2_String function as the control source for the text box on the form or report you want to print the currency amount on.

    For example:

    =Currency_2_String(115.87)

    Or, if you are referening a field from a record source for the form or report:

    =Currency_2_String(MyAmount)

    You could also put it directly into a query that would be the record source:

    CurrText: Currency_2_String([MyTable].[MyAmount])

  6. #6
    Join Date
    Apr 2006
    Posts
    9
    Thanks for your clearly explanation, but there will be two module!
    I had tried to put the value into Currency_2_String but nothing happen ....

    Could it be my table setting problem ? and how about the number_2_string ?

    thanks a lot.

  7. #7
    Join Date
    Apr 2006
    Posts
    9
    anyone thanks~~

  8. #8
    Join Date
    Apr 2006
    Posts
    9
    :!: :!: :!: STILL CANT SOLVE IT :!: :!: :!:

  9. #9
    StepUP is offline Advanced Beginner
    Windows 7 64bit Access 2000
    Join Date
    Dec 2005
    Posts
    99
    Post your database as a zip file and I'll set it up for you.

  10. #10
    Join Date
    Apr 2006
    Posts
    9
    Cant pm you.. can you give me your email address.

  11. #11
    Join Date
    Apr 2006
    Posts
    9
    can help on the said problem~~~

Please reply to this thread with any new information or opinions.

Similar Threads

  1. accurate currency values
    By eaanton in forum Access
    Replies: 1
    Last Post: 11-20-2008, 11:38 AM
  2. Change Date Into Number
    By greenbag in forum Queries
    Replies: 0
    Last Post: 11-14-2008, 04:43 PM
  3. tags and words in a row
    By bimfire in forum Access
    Replies: 0
    Last Post: 11-07-2007, 10:53 PM
  4. Change of label size
    By Zoroxeus in forum Programming
    Replies: 0
    Last Post: 06-11-2007, 08:18 AM
  5. Replies: 2
    Last Post: 06-18-2006, 10:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums