设 me.textbox1.value = "111 222 333"
先 s = replace (me.textbox1.value," "," ") '把两个空格变成一个空格,防止手工输入的时候多输入一个。 谨慎一点儿的话,就多执行几次,循环到len(s)不再减速少为止。
再 s = replace(s," ",","),把空格替换为, ,此时 s = 111,222,333
之后 sSql = "select * from yourTable where id in ("& s &")"
如果是字符型的话,注意加上''
ACMAIN_CHM 发表于 2009-2-7 00:32
欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) | Powered by Discuz! X3.3 |