How do I automate selecting "OK" on message box?

  • Thread starter Thread starter Sean Timmons
  • Start date Start date
S

Sean Timmons

OK, I have some code on a form to calculate a total based on updates within
the form. I do this by running 2 queries. When the 2nd query compeltes, if
there are updates, I get a message box "The data has been changed". Great
news, but now I have to click OK on this box, then close the underlying query
to get back to my form again. I'm going to have inexperienced Access users
entering this data. What kind of code can I use to automate selecitng OK for
this message box?
 
You can't automate the Ok, but there are several ways to avoid it.

Method 1: The best one is to execute the SQL statement in a way that
notifies you of any error, but doesn't bug you with the unnecessary
messages. See:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html

Method 2: If you really don't care whether it worked or not, you can just
turn SetWarnings off.

Method 3: For cases where you must close a dialog automatically, you can
create your own form to use in place of MsgBox, and use its Timer event.
 
Back
Top