Solved

Run qry in order via vba

Posted on 2013-12-05
4
330 Views
Last Modified: 2013-12-05
Hi Expert's using access 2003

I am trying to automate using the following vba a macro to run the following qys in order..

private sub cmdmybutton ()

Docmd.setWarnings False

Docmd "03 qry_apples"
Docmd "04 qry_oranges"

Docmd.setWarnings True
End Sub

in total I have 11 qry...not sure what I am doing wrong..step by step 8nstruction woukd be great in order to learn.

Bssically I want to call the qry's if its possible in access 2003.
0
Comment
Question by:route217
  • 3
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39697837
Your code is close... you just need to use the OpenQuery method


private sub cmdmybutton ()

Docmd.setWarnings False

Docmd.OpenQuery  "03 qry_apples"
Docmd.OpenQuery "04 qry_oranges"
' etc... repeat for all your queries

Docmd.setWarnings True
End Sub

Open in new window

0
 

Author Comment

by:route217
ID: 39697841
Excellent thanks always good to learn
0
 

Author Comment

by:route217
ID: 39697863
Hi mbizup

just testing the code getting a run time error 7874...saying microsoft office can't find the qry
0
 

Author Comment

by:route217
ID: 39697869
Forgot to mention my qry's are in  folder call end to end process in Group left hand plane once access opens up..
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

757 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

21 Experts available now in Live!

Get 1:1 Help Now