OK, I hope that I can explain this correctly.
I have an array called "Ids" that will hold up to four numbers at a time.
Example:
It may have (34,67,32,56)
Or maybe just (12,0,0,0)
If there is only one entry, the rest of the array is filled in with 0's
Now, I want to use this array to query my DB.
This is what I have done so far.
SQL = "SELECT Num FROM Table1 WHERE ID IN("
For a = 0 To UBound(Ids)
If lAccountIds(a) = 0 Then
SQL = SQL & Ids(a) & " )"
Else
SQL = SQL & Ids(a) & ","
End If
Next a
What I am trying to do is slap a ) on instead of a comma, when the last number is read.
Can anyone help me fix this?......or does anyone have a better method?
I appreciate your help!
I have an array called "Ids" that will hold up to four numbers at a time.
Example:
It may have (34,67,32,56)
Or maybe just (12,0,0,0)
If there is only one entry, the rest of the array is filled in with 0's
Now, I want to use this array to query my DB.
This is what I have done so far.
SQL = "SELECT Num FROM Table1 WHERE ID IN("
For a = 0 To UBound(Ids)
If lAccountIds(a) = 0 Then
SQL = SQL & Ids(a) & " )"
Else
SQL = SQL & Ids(a) & ","
End If
Next a
What I am trying to do is slap a ) on instead of a comma, when the last number is read.
Can anyone help me fix this?......or does anyone have a better method?
I appreciate your help!