Solved

Is it possible to loop through the results of a Docmd.OpenQuery

Posted on 2008-10-17
4
587 Views
Last Modified: 2013-11-27
Dim rs as New ADODB.Recordset
rs.Open "SELECT * from tblTest", etc.
Docmd.OpenQuery "qryTest"

Assume that the query qryText does the same query as "SELECT * from tblText".

Obviously, I have kept these very simple.  I know how loop through the rs recordset.  What I don't know is how do I loop through the results of the Docmd?  I know I can copy and past the SQL view from the query, but is there any way to access the results of the Docmd?
0
Comment
Question by:vlvawter
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
DatabaseMX (Joe Anderson - Access MVP) earned 50 total points
ID: 22745544
Not really. You need to use a Recordset.

mx
0
 
LVL 84

Assisted Solution

by:Scott McDaniel (Microsoft Access MVP - EE MVE )
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 50 total points
ID: 22745843
OpenQuery opens the query OBJECT in the query designer ... in other words, it doesn't really "run" a query, it just opens up the designer with a particular query. To me, a better name would have been DoCmd.OpenQueryDesign "YourQueryName' ... but the Access team didn't ask me <g> ...
0
 
LVL 75
ID: 22745863
"but the Access team didn't ask me"

Or me either ...

mx
0
 

Author Closing Comment

by:vlvawter
ID: 31507323
Ok, thanks.  I was hoping, but it simply didn't work out.
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question