vba - Why is my recordset result accessed repeatedly and not cached? -


i have dao.recordest called products assign this

set products = db.openrecordset("product urls sitemap") 

"product urls sitemap" query when ran makes use of custom vba function populate 1 of it's columns.

what expecting happen products contain contents of query after has ran, table. not seem case.

once have products recordset looping on , creating xml it

do while not products.eof     dim prdurl string     dim prdupdated string      prdurl = products!url     prdupdated = products!updated      xml = xml & createurlxml(products!url, products!updated)     products.movenext loop 

however during loop calling function used in "product urls sitemap" during each loop. should need done once - @ time populate products calling set products = db.openrecordset("product urls sitemap")

why getting called every time loop through products recordset , how stop this?

thanks

how use getrows(), simple example:

dim querytext string querytext = "select *, yourvbafunc([urls_source]) url table1;"  dim products dao.recordset set products = currentdb.openrecordset(querytext)  products.movelast products.movefirst  dim data variant data = products.getrows(products.recordcount)  ' data in array 'data' ... 

more information here: http://bytes.com/topic/access/insights/789969-retrieving-data-dao-recordset-using-getrows


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -