Prompts

M

Mac

Hello Group,

I have a form that runs an append query and delete query when the form is
closed. When the form is closed, Access presents a set prompts first
notifying me that I am about to run these queries, and then I am notified
that once these queries are run you can't use the Undo command to reverse
the changes.

I am wondering if there is any way, since I always want to run these queries
and since I never want to undo the changes, will access run them without the
promps? Yes, they are helpful at times, but if you know you always want to
run the queries, they get kind of annoying after awhile.

Running Access 2000 on XP.

Thanks you very much!
 
M

Mac

Thanks for the quick response. I was kind of hoping I wouldn't have to do
that. I was hoping it could be done on project by project basis. Darn :(

Thanks again
 
L

Larry Daugherty

Look in Help for Set Warnings. turn them off before your operations and be
sure to turn them back on after they're done.

HTH
 
M

Mark

One thing to watch out for when you use DoCmd.Setwarnings, is if you
encounter an untrapped error and you've set warnings to False, there's
nothing to set them back to True, and until you close your database and open
it again, there will be no warnings for any further operations. So make
sure you have at least some minimal error handling in your code and put
DoCmd.SetWarnings=True in the handler routine.

As an alternative to SetWarnings, you can use [CurrentDb.Execute
"YourQueryOrSQLHere"]. By using the .Execute command, action queries don't
generate the warning message prior to running, and don't generate any error
messages if they fail (so you're never sure if they worked or not). You can
add the dbFailOnError option to add some error handling in case the action
query causes an error.
 

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