问题
I have an activeX treeview control that has 4 levels of nodes (child nodes), each relating to a separate table which is stored on the backend of the database (in-house server). There are 3 queries and 4 dlookups which were required to make this treeview work.
As the database has started to become highly populated, the form with the treeview control has become slow to load (10 seconds). I would like to speed up this load time, I think converting to ADO is something I need to at least consider.
This is the only form that really loads such high quantity of data as its 4 tables and I am thinking that I may need to convert the query recordsets to ADO?
I don't know much about ADO or where its best applied, but as I'm using an activeX control maybe its best suited? I have only used DAO.recordset
on this form because the various reference VBA available use it.
Is ADO more appropriate for this scenario?
Will using ADO speed up the load time of my form?
Is it complicated to convert recordsets used in VBA to ADO?
NB: I'm not entirely sure how to go about converting my VBA code to ADO recordsets, but if its not appropriate I wont bother learning it
回答1:
the "trick" for fast loading a treeview is twofold
a) You should save / calculate the "Level-Number" (0 = Ground level, 1 etc. ) in beforehand so that you have the level-number handy when loading so that you can load the whole tree in one step without recursive searching. I personally always have a separate local treeview-table which contains all things, especially the level-number
b) Load the table info before loading into an Array and load it from there. best regards Klaus
来源:https://stackoverflow.com/questions/35336640/ms-access-treeview-control-slow-to-load-do-i-need-to-use-ado-instead-of-dao