一个自定义函数来分离字符串的方法
时 间:2004-08-11 00:00:00
作 者:竹笛 ID:8 城市:上海 QQ:2851379730
摘 要:一个自定义函数来分离字符串的方法
正 文:
问:请问该数据库中的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交流群 (群号:54525238) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 【Access选项卡示例】Ac...(09.09)
- 【Access源码示例】按输入...(09.02)
- 【Access日期区间段查询】...(08.29)
- 【Access日期区间段查询】...(08.27)
- Access怎样才能实现日期时...(08.21)
- 【Access定时打开查询】A...(08.19)
- Access生成固定数量的记录...(08.13)
- Access怎样才能实现日期时...(08.12)
- Access利用导航窗体控件对...(08.03)
学习心得
最新文章
- Access表中的字段名、字段标题...(09.19)
- Access快速开发平台--更改“...(09.18)
- 【中秋及国庆优惠】Access培训...(09.15)
- Access如何将日期型的数值转换...(09.14)
- 英文输入法输入数据中存在单引号引起...(09.11)
- 【Access选项卡示例】Acce...(09.09)
- 让Access光标停留在指定的控件...(09.07)
- 关于Access查询条件里使用通配...(09.06)
- Access报表偷懒制作法--Ac...(09.05)
- Access快速开发平台--窗体数...(09.04)