Access开发培训
网站公告
·Access专家课堂QQ群号:151711184    ·Access快速开发平台下载地址及教程    ·欢迎加入Access专家课堂微信群!    ·如何快速搜索本站文章|示例|资料    
您的位置: 首页 > 技术文章 > ADP及SQL SERVER

金额小写转大写的代码

时 间:2007-10-21 10:34:51
作 者:贺德才   ID:140  城市:襄樊
摘 要:大小写转换
正 文:

Public Function CH(A) As String
  Dim aa As String
  Dim bb As String
  Dim cc As String
  Dim dd As Byte
  Dim ee As Boolean
  Dim ff As Byte
  Dim i As Integer
  Dim qq As String
    On Error GoTo CH_Err
    If A >= 0 Then
     aa = Int((A + 0.005) * 100)
     Else
     aa = -Int((A + 0.005) * 100)
     End If
      dd = Len(aa)
        For i = dd To 1 Step -1
         qq = Mid(aa, dd - i + 1, 1)
          bb = Mid("零壹贰叁肆伍陆柒捌玖拾", qq + 1, 1)
           If qq <> "0" Then
             If ee = True Then
              cc = cc + "零" + bb + Mid("分角元拾佰仟万拾佰仟亿拾佰仟万拾佰", i, 1)
            Else
              cc = cc + bb + Mid("分角元拾佰仟万拾佰仟亿拾佰仟万拾佰", i, 1)
            End If
              ee = False
            Else
              If i = 1 And qq = "0" Then
                cc = cc + "整"
              If aa = 0 Then
                 cc = ""
              End If
           Exit For
           End If
              If (i Mod 4 = 3) Then
               If ff < 4 or i = 3 Then
                cc = cc + Mid("分角元拾佰仟万拾佰仟亿拾佰仟", i, 1)
               End If
              End If
            ee = True
         End If
       Next i
       If A >= 0 Then
     CH = cc
     Else
     CH = "负-" & cc
     End If
CH_Exit:
    Exit Function
CH_Err:
If A >= 0 And Len(Int(A)) >= 13 or A < 0 And Len(Int(A)) >= 14 Then
   
     MsgBox "对不起 !!!" + Chr(13) + "您输入的数值必须是:" & vbNewLine & "整数位不超过 13 位。", vbOKOnly, "警告"
    Else
    MsgBox Error$
    Resume CH_Exit
    End If
 End Function



Access软件网官方交流QQ群 (群号:54525238)       Access源码网店

常见问答:

技术分类:

相关资源:

专栏作家

关于我们 | 服务条款 | 在线投稿 | 友情链接 | 网站统计 | 网站帮助