设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 1043|回复: 3
打印 上一主题 下一主题

[窗体] Access人币民大写方法 代码

[复制链接]
跳转到指定楼层
1#
发表于 2008-6-20 21:53:26 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
qb = "XX数据"
End If
If vDec = "00" And qb <> "" Then '1.00
ret = ret + "整"
End If
If vDec = "00" And qb = "" Then '0.00
ret = "零"
End If
If Left(vDec, 1) <> "0" And Right(vDec, 1) = 0 And qb <> "" Then '1.20
ret = ret + Num2Char(Left(vDec, 1)) + "角整"
End If
If Left(vDec, 1) = "0" And Right(vDec, 1) <> 0 And qb <> "" Then '1.03
ret = ret + "零" + Num2Char(Right(vDec, 1)) + "分"
End If
If Left(vDec, 1) <> "0" And Right(vDec, 1) <> 0 And qb <> "" Then '1.23
ret = ret + Num2Char(Left(vDec, 1)) + "角" + Num2Char(Right(vDec, 1)) + "分"
End If
If Left(vDec, 1) <> "0" And Right(vDec, 1) = 0 And qb = "" Then '0.20
ret = Num2Char(Left(vDec, 1)) + "角整"
End If
If Left(vDec, 1) = "0" And Right(vDec, 1) <> 0 And qb = "" Then '0.03
ret = Num2Char(Right(vDec, 1)) + "分"
End If
If Left(vDec, 1) <> "0" And Right(vDec, 1) <> 0 And qb = "" Then '0.23
ret = Num2Char(Left(vDec, 1)) + "角" + Num2Char(Right(vDec, 1)) + "分"
End If
'★修正大写中出现重复零的问题.如:"800800"会写作"捌拾万零零捌佰元整".
'  修正大写"元"前出现多余零的问题.如:"800000.1"会写作"捌拾万零元整零壹角整".
'  修正大写结尾"整"前出现多余零的问题.如:"200"会写作"贰佰元零整".
js = 0
Do While js <> Len(ret)
js = Len(ret)
For S = 2 To Len(ret) - 1
  If Mid(ret, S, 1) = "零" Then
   If Mid(ret, S + 1, 1) = "零" Or Mid(ret, S + 1, 1) = "元" Or Mid(ret, S + 1, 1) = "整" Then
    ret = Left(ret, S - 1) + Right(ret, Len(ret) - S)
    Exit For
   End If
  End If
Next
Loop
'★
GetDXJE = ret
End Function
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2008-6-20 22:41:05 | 只看该作者
楼主的代码不齐全
3#
发表于 2008-6-20 23:51:51 | 只看该作者
现成的已经好多个了,LZ没有必要再自己搞了

点击这里给我发消息

4#
发表于 2008-6-21 00:19:17 | 只看该作者
可搜索一下论坛或首页,有完整的示例
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2025-1-9 22:18 , Processed in 0.094430 second(s), 28 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表