(Q) I´m looking to have Access convert the currency value "$531.20" into the text "Five hundred thirty one and twenty cents."
(A) Use the following function provided by Joe Foster to convert the Currency into English words.
´************ Code Start **********
´This code was originally written by Joe Foster.
´It is not to be altered or distributed,
´except as part of an application.
´You are free to use it in any application,
´provided the copyright notice is left unchanged.
´Code Courtesy of
´ Convert a currency value into an (American) English string
Function English (ByVal N As Currency) As String
Const Thousand = [email protected]
Const Million = Thousand * Thousand
Const Billion = Thousand * Million
Const Trillion = Thousand * Billion
If (N = [email protected]
) Then English = "zero": Exit Function
Dim Buf As String: If (N < [email protected]
) Then Buf = "negative " Else Buf = ""
Dim Frac As Currency: Frac = Abs(N - Fix(N))
If (N < [email protected]
Or Frac <> [email protected]
) Then N = Abs(Fix(N))
Dim AtLeastOne As Integer: AtLeastOne = N >= 1
If (N >= Trillion) Then
Buf = Buf & EnglishDigitGroup(Int(N / Trillion)) & " trillion"
N = N - Int(N / Trillion) * Trillion ´ Mod overflows
If (N >= [email protected]
) Then Buf = Buf & " "
If (N >= Billion) Then
Buf = Buf & EnglishDigitGroup(Int(N / Billion)) & " billion"