?
Solved

Run qry in order via vba

Posted on 2013-12-05
4
Medium Priority
?
351 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
[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
4 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Preparing an email is something we should all take special care with – especially when the email is for somebody you may not know very well. The pressures of everyday working life stacked with a hectic office environment can make this a real challen…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

743 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