Sieben - just spotted your reply. Thanks. "they're told that it's a bad idea to throw that number of records into a DBGrid (nobody really views 407k rows of data)" - this is increasingly making sense to me now. I assumed, wrongly, that the DBGrid was a useful GUI interface for rendering database content. In my case, they have been part of the tool for some years and it works very well for many users. Problem is it is all now rather part of the tool - you're right that folks dont view that many individual records, but they do expect to see "a table of data" and to be then able to export it\save it. I think it would be better to have it show ON SCREEN only X number of records, and then every time they scroll or move, it loads more. But...I don't know - I need to think of a better way to achive all this.
GetMem - sound advice for sure. I'm trying to work out how I would do that, for this larger task, appreciating I can see how it worked just for getting a row count, but itterating through every row might be more challenging for me.
Zvoni - "the moment you enable the DBGrid again, you try to load all 400K rows into the DBGrid, which is plain .... errr.... [insert word]" - I think by this you mean the "EnableControls" call? So I'm not massively good with the whole SQL thing to be honest, but from what I read, you have to (should) disablecontrols while you're doing lots with the data in the grid, so it doesnt refresh and try and updated itself. But you then have to enablecontrols afterwards (in a finally I read just now). So if you're saying that by doing that I am "loading all 400K rows into the DBGrid" AGAIN, then that is not what I intended to do. I assumed, perhaps wrongly, that when you disablecontrols, you freeze the grid, and when you enablecontrols, you unfreeze it. Not reload it all. But maybe that does reload it all. COnfusing.