I have a DAO.Recordest called products
which I assign like this
Set products = db.OpenRecordset("Product URLs for Sitemap")
"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.
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
However during this loop it is calling the function used in "Product URLs for Sitemap" during each loop. This should only need to be done once - at the time that I populate products
by calling Set products = db.OpenRecordset("Product URLs for Sitemap")
Why is this getting called every time I loop through the products
recordset and how do I stop this?
Thanks