|
下面是我写的一个函数,你只需要新建一模块将下面的代码复制进去,那么你在查询及报表及窗体中都可以使用了。方法:ConvertCH([字段名或控件名])
代码:
Public Function ConvertCH(num As String) As String
Dim chnum As String, chsig As String
Dim s, res As String
Dim i As Integer
chnum = ("零一二三四五六七八九")
chsig = "分角元拾佰仟万拾佰仟亿"
res = ""
num = num + IIf(InStr(num, ".") = 0, ".", "")
s = Left(num, InStr(num, ".") - 1) + Mid(num + " ", InStr(num, ".") + 1, 2)
For i = 1 To Len(s)
res = res + Mid(chnum, (Val(Mid(s, i, 1))) + 1, 1) + Mid(chsig, Len(s) - i + 1, 1)
Next i
ConvertCH = res
End Function
|
|