Kepada reken2x
Kami mohon bantuannya bagiamana penulisan module untuk
angka rupiah menjadi dalam huruf pada Microsoft
access.Adapun saya telah mempeolehnya dg sedikit
modifikasi dari saya (sbg.mana dibawah), namun untuk
Rp.100,-(tertulis satu ratus rupiah);dan
Rp.1.000,-(tertulis Satu Ribu Rupiah)

Terima kasih, bantuannnya

Function ConvertCurrencyToIndonesia(ByVal MyNumber)
  Dim Temp
         Dim rupiah, sen
         Dim DecimalPlace, Count

         ReDim Place(9) As String
         Place(2) = " ribu "
         Place(3) = " juta "
         Place(4) = " milyar "
         Place(5) = " trilyun "

         ' Convert MyNumber to a string, trimming
extra spaces.
         MyNumber = Trim(Str(MyNumber))

         ' Find decimal place.
         DecimalPlace = InStr(MyNumber, ".")

         ' If we find decimal place...
         If DecimalPlace > 0 Then
            ' Convert sen
            Temp = left(Mid(MyNumber, DecimalPlace +
1) & "00", 2)
            sen = ConvertPuluh(Temp)

            ' Strip off sen from remainder to convert.
            MyNumber = Trim(left(MyNumber,
DecimalPlace - 1))
         End If

         Count = 1
         Do While MyNumber <> ""
            ' Convert last 3 digits of MyNumber to
Indonesia rupiah.
            Temp = ConvertRatus(Right(MyNumber, 3))
            If Temp <> "" Then rupiah = Temp &
Place(Count) & rupiah
            If Len(MyNumber) > 3 Then
               ' Remove last 3 converted digits from
MyNumber.
               MyNumber = left(MyNumber, Len(MyNumber)
- 3)
            Else
               MyNumber = ""
            End If
            Count = Count + 1
         Loop

         ' Clean up rupiah.
         Select Case rupiah
            Case ""
               rupiah = " "
            Case "satu"
               rupiah = "satu rupiah"
            Case Else
               rupiah = rupiah & " rupiah"
         End Select

         ' Clean up sen.
         Select Case sen
            Case ""
               sen = " "
            Case "satu"
               sen = " , satu sen"
            Case Else
               sen = " , " & sen & " sen"
         End Select

         ConvertCurrencyToIndonesia = rupiah & sen
End Function


Private Function ConvertDigit(ByVal MyDigit)
        Select Case Val(MyDigit)
            Case 1: ConvertDigit = "satu"
            Case 2: ConvertDigit = "dua"
            Case 3: ConvertDigit = "tiga"
            Case 4: ConvertDigit = "empat"
            Case 5: ConvertDigit = "lima"
            Case 6: ConvertDigit = "enam"
            Case 7: ConvertDigit = "tujuh"
            Case 8: ConvertDigit = "delapan"
            Case 9: ConvertDigit = "sembilan"
            Case Else: ConvertDigit = ""
         End Select
         
End Function

Private Function ConvertRatus(ByVal MyNumber)
    Dim Result As String

         ' Exit if there is nothing to convert.
         If Val(MyNumber) = 0 Then Exit Function

         ' Append leading zeros to number.
         MyNumber = Right("000" & MyNumber, 3)

         ' Do we have a ratus place digit to convert?
         If left(MyNumber, 1) <> "0" Then
            Result = ConvertDigit(left(MyNumber, 1)) &
" ratus "
         End If

         ' Do we have a puluh place digit to convert?
         If Mid(MyNumber, 2, 1) <> "0" Then
            Result = Result &
ConvertPuluh(Mid(MyNumber, 2))
         Else
            ' If not, then convert the ones place
digit.
            Result = Result &
ConvertDigit(Mid(MyNumber, 3))
         End If

         ConvertRatus = Trim(Result)
End Function


Private Function ConvertPuluh(ByVal MyPuluh)
          Dim Result As String

         ' Is value between 10 and 19?
         If Val(left(MyPuluh, 1)) = 1 Then
            Select Case Val(MyPuluh)
               Case 10: Result = "sepuluh"
               Case 11: Result = "sebelas"
               Case 12: Result = "dua belas"
               Case 13: Result = "tiga belas"
               Case 14: Result = "empat belas"
               Case 15: Result = "lima belas"
               Case 16: Result = "enam belas"
               Case 17: Result = "tujuh belas"
               Case 18: Result = "delap belas"
               Case 19: Result = "sembilan belas"
               Case Else
            End Select
         Else
            ' .. otherwise it's between 20 and 99.
            Select Case Val(left(MyPuluh, 1))
               Case 2: Result = "dua puluh "
               Case 3: Result = "tiga puluh "
               Case 4: Result = "empat puluh "
               Case 5: Result = "lima puluh "
               Case 6: Result = "enam puluh "
               Case 7: Result = "tujuh puluh "
               Case 8: Result = "delapan puluh "
               Case 9: Result = "sembilan puluh "
               Case Else
            End Select

            ' Convert ones place digit.
            Result = Result &
ConvertDigit(Right(MyPuluh, 1))
         End If

         ConvertPuluh = Result
End Function


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ilkom_usu/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Kirim email ke