Dave said:
How do i turn these off using VBA?
I plan on adding the code to the OnOpen Event of my main form
I know i can do this Via the Tools, Options, Edit/Find Menu
But would save me a lot of hassle if i could do it automatically
You can turn off most warnings using the VBA line
DoCmd.SetWarnings False
and turn them on again using
DoCmd.SetWarnings True
I urge you *not* to do this in the Open event of your form, but rather
do it immediately before executing some code that would raise a warning,
and then turn warnings back on immediately after that code has been
executed. Care must be taken to ensure that warnings aren't left turned
off, or a user may later be dismayed or confused by the absence of
warnings. I don't think your code should suppress the normal
record-delete-confirmation that Access issues when the user deletes a
record via the user interface -- that should be the user's decision, as
indicated by the option setting. Some users are confident they will
never accidentally delete a record, but others are not.
Note that you can avoid warnings for action queries by executing them
via CurrentDb.Execute rather than by DoCmd.OpenQuery or DoCmd.RunSQL.