About query command on VBA..simple question

mfaqueiroz

Registered User.
Local time
Today, 09:22
Joined
Sep 30, 2015
Messages
125
Hei,

I've some simple doubts about how to work with queries on vba.
The follow command, always open the query?
DoCmd.OpenQuery "Query!Name", , acReadOnly
It is possible only to run the query without open it?


Thanks!
 
It depends if the query is a SELECT Query or an action query (UPDATE, DELETE or INSERT)
 
Minty in this case , i have two kinds of query that i need tu run without the user see it, one is a select query and other is a append .

Thanks!
 
What purpose would running a select query have without the user seeing the results? If it simply selects records what are you doing with them ?

To simply execute an action query without the user seeing things use ;
DoCmd.SetWarnings = False
DoCmd.OpenQuery "YourQueryName"
DoCmd.SetWarnings = True
 
DoCmd.RunSQL "yourQuery"

or

DBEngine(0)(0).Execute "yourQuery"
 

Users who are viewing this thread

Back
Top Bottom