Solved

modify vba code to run qry in groups sub folder end to end

Posted on 2013-12-05
3
440 Views
Last Modified: 2013-12-05
Hi Expert's

I have the following vba which needs amending to accommodate the fact my qry's are in a folder called end to end in the Groups plane once u open u Access 2003.


Sub CreateQuery() dim strSQL as string dim qdf as QueryDef strSQL = "SELECT Field1, Field2, Region FROM YourTable WHERE core = '" & me.txtCore & "' ORDER BY [GroupBy]" set qdf = Currentdb.CreateQueryDef("qryMyQuery", strSQL) docmd,OpenQuery "qryMyQuery" end sub
0
Comment
Question by:route217
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39697977
I don't think that what you are asking is possible.  The reason is that those 'groups' in the database window to my understanding are shortcuts, not actual objects.

However if these queries are indeed very similar, you can name them in a way that groups them together.  For example:

Query_01
Query_02
Query_03

etc

(You should give them more descriptive names, but the idea is to name them all with the same prefix and just use consecutive numbers for the last two characters.

If you name them like that, you can run them in order using a loop like this:


Dim I as integer
For I = 1 to 10
    docmd.OpenQuery "Query_" & Format(I, "00")
Next

Open in new window

0
 
LVL 17

Expert Comment

by:JezWalters
ID: 39698015
Is there any chance you could post a sample cut-down (and anonymised) database, to show your problem more clearly?
0
 

Author Comment

by:route217
ID: 39698070
Works...thanks mbizup
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

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

Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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.

626 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