Multiple Queries 1 Button

Valentine

Member
Local time
Today, 08:21
Joined
Oct 1, 2021
Messages
261
Hello I kinda found a solution but i am trying to make it work a little better. I want to run 2 saved queries with the push of one command button through VBA.

I know I can just
Code:
DoCmd.OpenQuery "Name of Query1"
DoCmd.OpenQuery "Name of Query2"

Does this make the queries visible or are they hidden?
If they are hidden how do I close them after I have run them?
If I order them like that will it run 1 then 2 because 2 needs info from 1?
 
It is poor practice to give users access to data by opening a query. Use a form so you can control whether or not the user can modify/add/delete data.

If you are talking about running action queries, they don't open for viewing. They just run and do whatever updating they are supposed to do.
 
Yeah I DO NOT want the user to have access to the query but I need the queries to run to get the data that the command button needs. I want the 2 queries to execute to gather any new information since last time the query was run so I can get the most up to date data.
 
I need the queries to run to get the data that the command button needs

This sounds very Rube Goldbergian. Why must the user click a button to load data? Are these 2 queries action queries (UPDATE, DELETE, INSERT)? Can you explain the entire situation a little more in depth?
 
Every day new things come in that get added to the database. I have a query that searches for specific parts of everything in the database. I need the button to basically refresh the query so that I can get this data into my form.
 
ok, how about is there a way to run a non visible query in VBA?
 
I need the button to basically refresh the query so that I can get this data into my form.
Unless the queries are action queries and are updating something, they are doing NOTHING for you. Just running a select query would not impact data shown by a form.
 

Users who are viewing this thread

Back
Top Bottom