Disable - re-enable prompt for action queries when db is opened an

G

Guest

I looked through past posts and didn't find quite what I am looking for.

What is the code and where do I place it to accomplish --> Turning off the
verification of action queries when a db file is opened. Then, turn on the
verification of action queries when a db file is closed (let's assume the
user closes the db by using the X and not the provided button on a navigation
form.)

Is it possible to do this for the instance of Access that is open? The
users may need to open additional databases, which may contain action
queries, and I want them to be prompted, if that is what they have chosen.

As always, thanks much.

Seth
 
D

Douglas J. Steele

It can be done, but it's a bad idea because it will block other messages
that could be useful.

To prevent those kinds of messages, issue DoCmd.SetWarnings False before
running the SQL, and DoCmd.SetWarnings True afterwards.

Better, though, is to use the Execute method of either the Database or
QueryDef object.

CurrentDb.Execute strSQL, dbFailOnError

Not only does it suppress the messages, but, because of the dbFailOnError
parameter, it will raise a trappable error if something goes wrong running
the query.
 

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