Closing

R

rob p

Starting a project, I need to run two passthru querys and then two make
table querys. I have an event on click on my command button. Code is

DoCmd.OpenQuery "querytblpr1", acviewNormal
DoCmd.OpenQuery "querytblpr5", acviewNormal

and the same for the two make table querys. I want to press one button and
run all 4 querys.

Anyway, after these 4 run, the two above querys are still open on my screen.
How can I run these 4 querys from a command button more in the background?
I tried Docmd.closequery but was getting errors.

thanks.
 
R

Rick Brandt

rob p said:
Starting a project, I need to run two passthru querys and then two make
table querys. I have an event on click on my command button. Code is

DoCmd.OpenQuery "querytblpr1", acviewNormal
DoCmd.OpenQuery "querytblpr5", acviewNormal

and the same for the two make table querys. I want to press one button and
run all 4 querys.

Anyway, after these 4 run, the two above querys are still open on my screen.
How can I run these 4 querys from a command button more in the background?
I tried Docmd.closequery but was getting errors.

Use the execute method instead

CurrentDB.Execute "querytblpr1", dbFailOnError
CurrentDB.Execute "querytblpr5", dbFailOnError

Another advantage of this is you do not get the confirmation messages.
 
R

rob p

Sorry it took me a bit to get to message. The code errors out "Cannot
execute a select query" on the first statement.
rob
It is a passthru query getting data from Mas90 ODBC.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top