Quote Originally Posted by Nouyana View Post
Try to use the undocumented Collect property. It's 20% faster. Works with both - ADO and DAO. Or you may use GetRows getting by 10 rows step by step.



You may don't now what is in the table. Maybe you just want to SELECT * FROM unknown_table. If it's an object then you can insert the "object" word. In the Excel nothing is inserted from fields with objects. But with no errors of course.

In addition, I think that cutting rows and cols should be optional. Say, you have an dbOpenForwardOnly DAO recordset (which consumes low memory) and therefore you cannot determine the number of records, but you want to get them all.

Ultimately, the CopyFromRecordset function only makes sense if it is more than just a wrapper for the GetRows method.
With the object you need to explain what exact datatype the problematic field has so to check for it.
Of course it should be improved in that regard.

With your dbOpenForwardOnly DAO is problematic.
Here you better do a .moveNext and .AddItem each time until .EOF.
Or alternatively you make first a SELECT COUNT(*) and then adjust the grid rows and then feed via CopyFromRecordset from your dbOpenForwardOnly DAO.