Hi
I've built a spreadsheet where I've got a list of say 200,000 Customer Reference Numbers and I setup a loop like
For i = 1 to 200000
Range("CustomerID") = Range("ListofCustomers").cells(i)
Call ProcessCustomer
Next i
ProcessCustomer is the macro that does all the hardwork for the customer currently in Range("CustomerID"). There's a list of select queries specified in the spreadsheet and the macro loops through each of the select queries, opening the recordset and pasting the results into the spreadsheet. See https://www.mrexcel.com/forum/excel-questions/1093956-ado-wild-card-confusion.html if a more detailed description helps. After it has pasted in that data, in then copies down formulas to the match the number of rows of data.
The problem
------------
It was taking about 1.5 seconds per customer - which isn't too bad considering all it has to do. But that's about 83 hours................It all worked fine
BUT
I noticed that a lot of the records that were in some of the database tables were no longer required. So I deleted those records and compacted/repaired the database. Once that was done, things really sped up and it was now down to taking just roughly 0.5 seconds per customer. HOWEVER, Excel now crashes/stops responding after a random number of customers. Sometimes it does the first 2800 customers say before crashing, other times it only does the first 200 customers before crashing.
Is it possible that the ADO/DB/VBA are now trying to do things too quickly?
Thanks
I've built a spreadsheet where I've got a list of say 200,000 Customer Reference Numbers and I setup a loop like
For i = 1 to 200000
Range("CustomerID") = Range("ListofCustomers").cells(i)
Call ProcessCustomer
Next i
ProcessCustomer is the macro that does all the hardwork for the customer currently in Range("CustomerID"). There's a list of select queries specified in the spreadsheet and the macro loops through each of the select queries, opening the recordset and pasting the results into the spreadsheet. See https://www.mrexcel.com/forum/excel-questions/1093956-ado-wild-card-confusion.html if a more detailed description helps. After it has pasted in that data, in then copies down formulas to the match the number of rows of data.
The problem
------------
It was taking about 1.5 seconds per customer - which isn't too bad considering all it has to do. But that's about 83 hours................It all worked fine
BUT
I noticed that a lot of the records that were in some of the database tables were no longer required. So I deleted those records and compacted/repaired the database. Once that was done, things really sped up and it was now down to taking just roughly 0.5 seconds per customer. HOWEVER, Excel now crashes/stops responding after a random number of customers. Sometimes it does the first 2800 customers say before crashing, other times it only does the first 200 customers before crashing.
Is it possible that the ADO/DB/VBA are now trying to do things too quickly?
Thanks