为什么我的记录结果反复访问,而不是缓存? [英] Why is my recordset result accessed repeatedly and not cached?

查看:181
本文介绍了为什么我的记录结果反复访问,而不是缓存?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为DAO.Recordest 产品这是我分配是这样

I have a DAO.Recordest called products which I assign like this

Set products = db.OpenRecordset("Product URLs for Sitemap")

产品网址站点地图是在跑使用了一个自定义的VBA函数来填充它的一个栏目,查询

"Product URLs for Sitemap" is a query which when ran makes use of a custom VBA function to populate one of it's columns.

我所希望发生的是,产品将包含查询的内容已经跑了之后,就像一个表。然而,这似乎并不如此。

What I am expecting to happen is that products will contain the contents of the query after it has ran, like a table. However this does not seem to be the case.

在我有我的产品记录我然后遍历它,创造它从一些XML

Once I have my products recordset I am then looping over it and creating some XML from it

Do While Not products.EOF
    Dim prdUrl As String
    Dim prdUpdated As String

    prdUrl = products!url
    prdUpdated = products!updated

    XML = XML & createUrlXml(products!url, products!updated)
    products.MoveNext
Loop

不过这个循环过程中被调用每个循环中使用的产品网址网站地图的功能。这应该只需要进行一次 - 在我填充产品时间致电套装产品= db.OpenRecordset(产品的网站地图网址 )

这是为什么获取调用通过产品的记录,我如何停止?

Why is this getting called every time I loop through the products recordset and how do I stop this?

感谢

推荐答案

如何使用GetRows的(),简单的例子:

How to use GetRows(), simple example:

Dim queryText As String
queryText = "SELECT *, YourVBAFunc([URLs_SOURCE]) AS URL FROM Table1;"

Dim products As DAO.Recordset
Set products = CurrentDb.OpenRecordset(queryText)

products.MoveLast
products.MoveFirst

Dim data As Variant
data = products.GetRows(products.RecordCount)

' then all data are in the array 'data' ...

这里更多的信息: 的http://bytes.com/topic/access/insights/789969-retrieving-data-dao-recordset-using-getrows

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

这篇关于为什么我的记录结果反复访问,而不是缓存?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆