Thanks for the reply! I am doing all of what you said here except instead of grouping I'm using a SELECT DISTINCT and writing all the unique values to an array and using each array value in a new recordset query.
I am having one issue though - I am able to find all the unique values and run the second query. Once I run it, it finds all the records with that criteria and writes them to an excel file. It then creates an email and attaches the file. However, on the next iteration of the loop I get a runtime error 424 "Object required" on this line: "r.copyfromrecordset rsXL2"
Any help? I suspect there is an issue of opening a new workbook on the second iteration, but I could be wrong.
Bookmarks