ldoodle
01-07-2015, 08:40 AM
Hey,
I'm passing user input (InputBox) to a SQL query:
dim array as variant
array = split(userinput, ";")
select ...
from...
where x in ( join(array, ",") )
The problem is the values are strings, so I need to wrap single quotes around each of the values in array.
Can't quite figure this one out! I've tried looping through array, writing out to newarray, but my recordset reports subscript out of range when I do this. Removing the single quotes fixes it:
dim newarray as variant
for i = 0 to ubound(array)
newarray(i) = "'" & array(i) & "'"
next i
Thanks
I'm passing user input (InputBox) to a SQL query:
dim array as variant
array = split(userinput, ";")
select ...
from...
where x in ( join(array, ",") )
The problem is the values are strings, so I need to wrap single quotes around each of the values in array.
Can't quite figure this one out! I've tried looping through array, writing out to newarray, but my recordset reports subscript out of range when I do this. Removing the single quotes fixes it:
dim newarray as variant
for i = 0 to ubound(array)
newarray(i) = "'" & array(i) & "'"
next i
Thanks