How to prevent pop-up box

  • Thread starter Thread starter John Michael
  • Start date Start date
J

John Michael

I am updating a table with an SQL statement in a VBA module when you click a
command button on a form that closes the form after doing some background
stuff.

When it updates the table, it then pops open a form asking if you approve of
the update before closing the form.

How can you suppress this pop-up box.

Thanks
John Michael
 
Use the SetWarnings method of the DoComd object. Just
before your SQL executes use DoCmd.SetWarnings :-

DoCmd.SetWarnings False

Do your SQL stuff

DoCmd.SetWarnings True

It is good practice to turn them back on again.
 
The nice thing about using the Execute method is that you can trap for
errors as well:

CurrentDb.Execute strSQL, dbFailOnError
 
Doug,

Doesn't using CurrentDb imply a late bind to DAO?

Not that that's bad, I'm just curious.
 
To be honest, I'm not sure. It works in Access 2000 and 2002 without setting
a reference, so it may well be late bound.
 
Back
Top