I am wondering if anyone can help me out with a looped OLE DB connection macro I am trying to write. Essentially what I need do do is run an already developed macro for mutliple unique identifiers to create a large table. Currently I have a macro in which you input a specific tract identifier (Im in real estate), and then multiple feilds such as IRR, NPV, $/area, and others are calculated by the macro and placed in one row of data in the first sheet. The specific identifier used is an input by the user in the first sheet, the macro then runs a querry on the Acess DB to import only those rows which contain the specific identifier in one feild (TractID):

Formula: copy to clipboard
Please Login or Register  to view this content.

---------------------------------------then comes the body of the macro

My plan is to add a new sheet to make my "mega" table, and at the end of the macro input a copy and past function which pastes in the next open row of the Table. for example say the data is in row 7:

Formula: copy to clipboard
Please Login or Register  to view this content.


(the first two rows in the MegaTable sheet will have headers, so xlDown will work) by doing this I can run it in a loop and it will past below the last row as the table is built.

So, How do I set up a loop in the OLE DB connection to run through all of the unique identifiers in the database in a certain feild? I know I must change something in the query. would I need to make a list of all the unique identifiers in excel to then run through all of those? or could i skip this step and set up a hidden query that could pull these from the Access database? or would it be best to not do a loop, but just use the OLE DB connection to import all of the data at once and then create a new macro? (this would take quite a long time) Any suggestions would be much appreciated. Ive searched online and though my reference books and cant find anything. THANKS!

PS. I would attach an example but the data cant leave our office.