Running Queries with code

halem2

Registered User.
Local time
Yesterday, 21:25
Joined
Nov 8, 2006
Messages
180
Hi All:

long time no ask! Running MS Access 2003.

I'm trying to run a couple of queries using code and it works fine but when it runs you can actually see the query window open and close really fast.

How can I run it without showing the query window?

This is my simple code

DoCmd.SetWarnings False

DoCmd.OpenQuery "qryOne"
DoCmd.OpenQuery "qryTwo"

DoCmd.SetWarnings True

thanks :confused:
 
Have you tried:

CurrentDb.Execute "qryOne"
CurrentDb.Execute "qryTwo"
 
I just tried it but it errors out since it is a select query

Cannot execute a select query. (Error 3065)
You tried to use the Execute method with a select query. The Execute method is valid only with action queries. Select queries contain a SELECT statement and can return records; action queries do not.


thanks for the help.
 
If they are select queries, then I don't see why you are opening them but don't want to see them. There is no value in that. What exactly are you trying to accomplish with them.
 
I'm connecting to a tbl in a db (db1) to get information to create another tbl in a different db (db2). The information is employee demographics so what I did in order to have my own employee table in db2 was to create a make table qry to create the original employee table. I do not use the make tbl again.

After the employee tbl was created then using an unmatched qry I get the changes from db1 (such as new employees or terminations) and run an update qry against the employee tbl in db2 (mine). The whole idea is to to have a key in the employee table that I could use. If I run a make tbl qry every time, then I loose the key.

I really do not need to see the qrys, just run them.
 
Last edited:

Users who are viewing this thread

Back
Top Bottom