會(huì)員登錄 - 用戶(hù)注冊(cè) - 網(wǎng)站地圖 Office中國(guó)(office-cn.net),專(zhuān)業(yè)Office論壇
當(dāng)前位置:主頁(yè) > 源碼 > Access源碼示例 > 界面/窗體/控件 > 正文

access數(shù)字轉(zhuǎn)英文大寫(xiě)示例源碼

時(shí)間:2014-02-08 16:14 來(lái)源:office中國(guó) 作者:宿命的風(fēng) 閱讀:
軟件類(lèi)型:國(guó)產(chǎn)軟件 授權(quán)方式:免費(fèi)軟件 界面語(yǔ)言:簡(jiǎn)體中文 軟件大。425 KB 文件類(lèi)型:.rar 運(yùn)行環(huán)境:Win2003,WinXP,Win7,win8 軟件等級(jí):★★★★★ 發(fā)布時(shí)間:2014-02-08 插件情況:無(wú)插件,請(qǐng)放心使用。 下載次數(shù):
軟件介紹:
    阿拉伯?dāng)?shù)字轉(zhuǎn)英文,數(shù)字轉(zhuǎn)中文數(shù)字,中文數(shù)字轉(zhuǎn)大寫(xiě)數(shù)字。這些我們轉(zhuǎn)換我們會(huì)經(jīng)常用到。特別是會(huì)計(jì)財(cái)務(wù)行業(yè)。
    下面的示例是一個(gè)自定義函數(shù),數(shù)字(整數(shù))轉(zhuǎn)英文大寫(xiě):數(shù)量轉(zhuǎn)為英文數(shù)量,金額轉(zhuǎn)為英文金額。

Function SpellNumber(ByVal MyNumber)
    Dim Dollars, Cents, Temp
    Dim DecimalPlace, Count
    ReDim Place(9) As String
    Place(2) = " Thousand "
    Place(3) = " Million "
    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 <> "" Then Dollars = Temp & Place(Count) & Dollars
        If Len(MyNumber) > 3 Then
            MyNumber = Left(MyNumber, Len(MyNumber) - 3)
        Else
            MyNumber = ""
        End If
        Count = Count + 1
    Loop
    Select Case Dollars
        Case ""
            Dollars = "No Amount "
        Case "One"
            Dollars = "One"
         Case Else
            Dollars = Dollars
    End Select
    Select Case Cents
        Case ""
            Cents = " and No Cents"
        Case "One"
            Cents = " and One Cent"
              Case Else
            Cents = " and " & Cents & " Cents"
    End Select
    SpellNumber = Dollars & Cents
    
End Function</P>
<P>' 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" &amp; MyNumber, 3)
    ' Convert the hundreds place.
    If Mid(MyNumber, 1, 1) &lt;&gt; "0" Then
        Result = GetDigit(Mid(MyNumber, 1, 1)) &amp; " Hundred "
    End If
    ' Convert the tens and ones place.
    If Mid(MyNumber, 2, 1) &lt;&gt; "0" Then
        Result = Result &amp; GetTens(Mid(MyNumber, 2))
    Else
        Result = Result &amp; GetDigit(Mid(MyNumber, 3))
    End If
    GetHundreds = Result
End Function</P>
<P>' 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 = "Ten"
            Case 11: Result = "Eleven"
            Case 12: Result = "Twelve"
            Case 13: Result = "Thirteen"
            Case 14: Result = "Fourteen"
            Case 15: Result = "Fifteen"
            Case 16: Result = "Sixteen"
            Case 17: Result = "Seventeen"
            Case 18: Result = "Eighteen"
            Case 19: Result = "Nineteen"
            Case Else
        End Select
    Else                                 ' If value between 20-99...
        Select Case Val(Left(TensText, 1))
            Case 2: Result = "Twenty "
            Case 3: Result = "Thirty "
            Case 4: Result = "Forty "
            Case 5: Result = "Fifty "
            Case 6: Result = "Sixty "
            Case 7: Result = "Seventy "
            Case 8: Result = "Eighty "
            Case 9: Result = "Ninety "
            Case Else
        End Select
        Result = Result &amp; GetDigit _
            (Right(TensText, 1))  ' Retrieve ones place.
    End If
    GetTens = Result
End Function</P>
<P>' Converts a number from 1 to 9 into text.
Function GetDigit(Digit)
    Select Case Val(Digit)
        Case 1: GetDigit = "One"
        Case 2: GetDigit = "Two"
        Case 3: GetDigit = "Three"
        Case 4: GetDigit = "Four"


數(shù)字轉(zhuǎn)英文自定義函數(shù)
http://m.mzhfr.cn/forum.php?mod=viewthread&tid=33428
頂一下
(1)
50%
踩一下
(1)
50%
下載地址:
注意事項(xiàng):

☉推薦使用第三方專(zhuān)業(yè)下載工具下載本站軟件,使用 WinRAR v3.10 以上版本解壓本站軟件。
☉如果這個(gè)軟件總是不能下載的請(qǐng)點(diǎn)擊報(bào)告錯(cuò)誤,謝謝合作!!
☉下載本站資源,如果服務(wù)器暫不能下載請(qǐng)過(guò)一段時(shí)間重試!
☉如果遇到什么問(wèn)題,請(qǐng)到本站論壇去咨尋,我們將在那里提供更多 、更好的資源!
☉本站提供的一些商業(yè)軟件是供學(xué)習(xí)研究之用,如用于商業(yè)用途,請(qǐng)購(gòu)買(mǎi)正版。

發(fā)表評(píng)論
請(qǐng)自覺(jué)遵守互聯(lián)網(wǎng)相關(guān)的政策法規(guī),嚴(yán)禁發(fā)布色情、暴力、反動(dòng)的言論。
評(píng)價(jià):