Respond to dialog boxes programatically

T

Tomas C

Howdy Folks,

I would like to use a form to run a number of action queries. My user
would enter a year and a quarter in two text boxes and then hit a button
on the form to run the queries. Of course, running an action query
throws up several confirmation dialog boxes. I would like to
programatically respond to those prompts so that the user does not see them.

How do I accomplish this? Can it be done with an Access macro, or do I
need to learn some VB and use a module? Any tips or resources you could
point me toward would be greatly appreciated. Thanks in advance.
 
R

Ron2006

The command you are looking for is
docmd.setwarnings False

This can be executed as a line in an existing macro or simply as an
extra line before the commands to
docmd.openquery


To sent the warnings back on after (if you want to) use
docmd.setwarnings True



Ron
 
D

Dale Fye

If these are action queries, you could also use the Execute method, which
bypasses the warning messages.

currentdb.execute strSQL, dbFailOnError

If you leave off the dbFailOnError, you will get no message if your query
fails for any reason. I always add this and have an error handler in my code
to address errors that might show up (this is extremely useful during the
code writing process and makes your application much more user friendly).

HTH
Dale
 

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