一个自定义函数来分离字符串的方法
时 间: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交流群 (群号:483923997) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 【Access窗体导出PDF】...(04.08)
- 【Access窗体导出PDF】...(04.07)
- Access两种方式实现即时更...(03.01)
- Access隐藏与显示lacc...(01.12)
- 【Access高效办公】将每个...(12.23)
- Access21点游戏源代码(12.13)
- 【Access窗体导出Exce...(11.15)
- 【Access开发】Acces...(11.14)
- 通过Access宏录入数据到选...(11.10)
学习心得
最新文章
- ACCESS精华集锦资料.CHM(04.25)
- Access VBA语句If Me...(04.24)
- 【Access修改记录示例】编辑选...(04.22)
- 【Access表名称命名建议】将A...(04.20)
- Access学习笔记--用Acce...(04.19)
- 【Access重复项查询示例】将A...(04.17)
- Access快速开发平台企业版--...(04.16)
- 【Access模块示例】通过模块代...(04.15)
- Access查询里面分组合计功能添...(04.13)
- 【Access删除查询】删除数字最...(04.12)