Hi Vittorio
Assuming you have the IDs listed in col A of Sheet1 starting from A2 then you need to build up a string to hold the various IDs. Do this first by extrcating the IDs into a variant array:
Next we need to convert this variant array of IDs into a string of IDs bounded by single-quotes and commas:
Now you have your list, you need to incorporate into your SQL string. The SQL operator IN is the one you want to use, as you have multiple values:
Note that I think there is an upper limit to how longg strings can be when using the Open method of the Recordset object (with ADO). If you do run into this barrier, you can get around it, I believe) by using the ADO command object.
Another thing is I have assumed your IDs are textual above - if this is not the case and they are simply numeric numbers then you probably won't need the singlwe quotes around all the values.
Richard
Bookmarks