Office中国论坛/Access中国论坛
标题:
在ASP中可以这样,VBA可以吗?
[打印本页]
作者:
xinle
时间:
2008-4-23 12:37
标题:
在ASP中可以这样,VBA可以吗?
在ASP中可以这样
Dim strTxt, strTmpTxt
strTxt = "10,11,12,13,14,15,16,17"
strTmpTxt = Split(strTxt, ",")
for i= 0 to ubound(strTmpTxt )
Response.Write "xx(" & i & ")=" & strTmpTxt (i) & vbCrLf
next
可以输出为:
xx (0) = 10
xx (1) = 11
xx (2) = 12
... ....
请问在access的VBA中如何实现?
谢谢
作者:
xinle
时间:
2008-4-23 15:30
没有高手知道么?
作者:
andymark
时间:
2008-4-23 15:42
for i= 0 to ubound(strTmpTxt )
debug.print strTmpTxt(i)
next
作者:
轻风
时间:
2008-4-23 16:37
Response.Write 改为 Debug.Print 即可
作者:
xinle
时间:
2008-4-23 17:34
晕,这个知道,
为什么我在用 Split() 和 ubound() 这两个函数时提示错误?
作者:
xinle
时间:
2008-4-23 17:49
不指定类型:Dim strTxt, strTmpTxt 就可以
如果:Dim strTxt as string, strTmpTxt as string 就提示错误。
Split() 函数需要一个数组,
如果 "10,11,12,13,14,15,16,17"是通过ADO从表中取出来的文本,
预先不知道是多少,有多少个,
这个数组应该怎么定义呢?
作者:
andymark
时间:
2008-4-23 17:59
原帖由
xinle
于 2008-4-23 17:34 发表
晕,这个知道,
为什么我在用 Split() 和 ubound() 这两个函数时提示错误?
2000版本不支持split
作者:
Grant
时间:
2008-4-23 18:32
在另外一个论坛也给你回答了~
Private Sub Command0_Click()
Dim strTxt ,strTmpTxt() As String
strTxt = "10,11,12,13,14,15,16,17"
strTmpTxt() = Split(strTxt, ",")
For I = 0 To UBound(strTmpTxt)
Debug.Print "xx(" & I & ")=" & strTmpTxt(I) & vbCrLf
Next
End Sub
作者:
xinle
时间:
2008-4-23 19:03
哦,非常感谢!
我曾经试过 dim strTxt() as string ,
也提示错误,以为不支持,笨啊。。。。
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/)
Powered by Discuz! X3.3