Closing

  • Thread starter Thread starter rob p
  • Start date Start date
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.
 
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.
 
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.
 
Back
Top