dim str as string
dim sql as string
dim i as integerstr="("for i=0 to ubound(b)
str = str & cstr(b(i)) & ","
nextstr = left(str,len(str)-1) & ")"sql = "select * from table where id in " & str
dim sql as string
dim i as integerstr="("for i=0 to ubound(b)
str = str & cstr(b(i)) & ","
nextstr = left(str,len(str)-1) & ")"sql = "select * from table where id in " & str
把 B中数据循环插入TtlTemp
select * from A where Id in(select ID from tblTemp)
Dim strSql As String
Dim i As Integer
Dim b(1 To 10) As IntegerstrSql = "select * from A where id in('"
For i = 1 To 10
strSql = strSql & Trim(Str(b(i))) & "','"
Next i
strSql = Left(strSql, Len(strSql) - 2) & ")"
Debug.Print strSql
End Sub
strSQL="select * from A where Id in(" & join(b, ",") & ")"
rstData.open strSQL, ...
"select * from A where id in("& strb &")"中的STRB是必须要以逗号分了???
select * from A where id in {1,2,5}