Surpress warning messages

A

AzJennings

Is there any way to surpress warning messages. For a production environment
there are in my view too many dialog boxes with warning messages requiring a
respone from the user.
 
D

Douglas J. Steele

I assume you're talking about the "You're about to add..." type messages
that occur when you use RunSQL or RunQuery to run SQL.

You can issue a DoCmd.SetWarning False before you run the SQL and then issue
a DoCmd.SetWarning True afterwards, or, better in my opinion, you can use
the Execute method of the Database or QueryDef object.

CurrentDb.Execute "INSERT INTO ...", dbFailOnError

CurrentDb.QueryDefs("MyQuery").Execute dbFailOnError

The advantage of using Execute is that when you supply the dbFailOnError
parameter, any errors can be trapped by your error handling routine.
 
Top