一个自定义函数来分离字符串的方法 -张志
Access软件网QQ交流学习群(群号码198465573),欢迎您的加入!
首页 >技术文章> Access数据库-模块/函数/VBA


一个自定义函数来分离字符串的方法

发表时间:2004/8/11 评论(0) 浏览(8374)  评论 | 加入收藏 | 复制
   
摘 要:一个自定义函数来分离字符串的方法
正 文:

:请问该数据库中的type列,怎么用查询,以逗号将该数据分割开
:通过下面的自定义函数,结合查询来达到这一目的:
Function A(strType As String)
Dim x As Integer
x = InStr(strType, ",") - 2
A = Mid(strType, 2, x)
End Function
Function B(strType As String, strType2 As String)
    Dim x As Integer
    Dim typeTemp As String
    typeTemp = Mid(Replace(strType, strType2, ""), 3)
    x = InStr(typeTemp, ",") - 2
    If x > 0 Then
        B = Mid(typeTemp, 2, x)
    Else
        B = Mid(typeTemp, 2)
    End If

End Function
Function C(strType As String, strType2 As String, strType3 As String)
    Dim x As Integer
    Dim y As Integer
    Dim typeTemp As String
    x = Len(strType2 & strType3) + 6
    typeTemp = Mid(strType, x)
    y = InStr(typeTemp, ",") - 1
    If y > 0 Then
        C = Mid(typeTemp, 1, y)
    Else
        C = Replace(typeTemp, """", "")
    End If

End Function
Function strD(strType As String, strType2 As String, strType3 As String, strType4 As String)
    Dim x As Integer
    Dim typeTemp As String
    x = Len(strType2 & strType3 & strType4) + 6
    typeTemp = Mid(strType, x)
    strD = Mid(typeTemp, 2)

End Function

示  例:见下面的链接

更多参考:
论坛中本主题相关讨论帖子链接: cgi-bin/dispbbs.asp?boardID=90&ID=1905


Access软件网交流QQ群(群号:198465573)
 
 相关文章
[access查询]工商银行账号16-19位账号分离程序  【丘山  2011/10/22】
【Access源码示例】提取字符串中的字母\把数据中的字母筛选出来  【红尘如烟  2012/2/20】
【access源码示例】按乘号提取数字\带有分割符号数据的提取示例...  【红尘如烟  2012/6/13】
【Access自定义函数】不规则提取日期数据的示例  【红尘如烟  2013/2/13】
【Access小品】继往开来--用正则表达式提取信息示例  【煮江品茶  2013/3/3】
【Access小品】无关紧要--提取字符串中的数字示例  【煮江品茶  2013/3/15】
常见问答
技术分类
相关资源
文章搜索
关于作者

张志

文章分类

文章存档

友情链接