Run an Action Query

D

Dkline

I need to run an Action Query through VBA. I just want to run it. I don't
need it to open or anything - just run and go away.

I've been playing with DoCmd.OpenQuery which opens the query. I've tried the
suggestion is a different thread of:
DoCmd.SetWarnings False 'disable warnings
DoCmd.OpenQuery <queryname>
DoCmd.SetWarnings True 'enable warnings

How can I make it go away as using the above the query is still open?
 
B

Brendan Reynolds

CurrentDb.Execute "YourQueryName"

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
T

Tim Ferguson

I need to run an Action Query through VBA. I just want to run it. I
don't need it to open or anything - just run and go away.

Querydefs("MyActionQuery").Execute dbFailOnError

B Wishes


Tim F
 
S

Steve Schapel

Dkline,

Whereas Brendan's suggestion is a valid alternative to the method you
were using, I fear you will encounter the same problem. If it is an
action query (i.e. Append, Delete, Update, etc), then DoCmd.OpenQuery
should work, i.e. as you put it "just run and go away". If you are
finding the "query is still open", by which I assume you mean you see a
query datasheet, then it sounds like the query you are nominating is a
Select Query, and not an action query.
 
D

Dkline

Stupid question time - what if it's not in the CurrentDB?

So I've been trying to persuade Access to create a new instance of Access,
open a database, run a make table query, and then close.

It's barking about the path/file name which is "\\Server03\shared\policy
database\policy database tables.mdb"
 

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