I have a query that I want to execute against a table. With the results I want to do something. In my head the pseudo code is:
var q = "select * from table where some condition";
var results = db.getResults(q);
foreach (row r in results )
do something with result
How would I so something similar with vba?
I know some things have changed in AC 2010. However, the old-fashioned ADODB is, as far as I know, the best way to go in VBA. An Example:
DAO is native to Access and by far the best for general use. ADO has its place, but it is unlikely that this is it.
Ahh. Because I missed the point of you initial post, here is an example which also ITERATES. The first example did not. In this case, I retreive an ADODB recordset, then load the data into a collection, which is returned by the function to client code:
EDIT: Not sure what I screwed up in pasting the code, but the formatting is a little screwball. Sorry!
End Function