Solved

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

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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

705 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

19 Experts available now in Live!

Get 1:1 Help Now