设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

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

用函数解决--找出数字

[复制链接]
1#
发表于 2008-4-9 22:07:08 | 显示全部楼层
自定义函数 算不算函数 ?
2#
发表于 2008-4-9 22:24:41 | 显示全部楼层
自定义函数  

Public Function GetNum(StrValue As String) As String
'用法: GetNum("2fg行ksj5--2405     ")  返回结果:252405

Dim IntLen As Integer
Dim I As Integer
Dim Str As String
Dim StrNum As String
IntLen = Len(StrValue)
For I = 1 To IntLen
     Str = Mid(StrValue, I, 1)
    If Asc(Str) > 47 And Asc(Str) < 58 Then
        StrNum = StrNum & Str
    End If
  Next I

GetNum = StrNum
   
End Function
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-4 14:49 , Processed in 0.137216 second(s), 25 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

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