Solved

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

Posted on 2008-10-17
4
572 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

895 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now