- database solutions and downloads for microsoft access

Microsoft Access Warning Messages

Suppress Microsoft Access Action Query Warning Messages

When automating actions in Microsoft Access such as running Action queries, you may wish to avoid any user intervention, for example having to OK warning messages when running an Update, Make-Table, Delete or Append query.

If we run this type of query, without turning off the system messages, the user will be prompted to OK any actions that occur. The following shows the Warning message when running a Make-Table query:

Microsoft Access Warning message when running a Make-Table query
Microsoft Access Warning message when running a Make-Table query

If we decide that the user should not see this message we can set the options to turn it off when we run the command. This will usually be actioned from a command button somewhere within the user interface of the application.

The following example shows how to turn off the warning messages:

Private Sub cmdRunMakeTable_Click()
    DoCmd.Hourglass True
        'Turns off the Access warning messages
        DoCmd.SetWarnings False
            DoCmd.OpenQuery "mktqry_MakeNewTable"
    DoCmd.Hourglass False
        'Turns the Access warning messages back on
        DoCmd.SetWarnings True
End Sub

You should only consider setting these options once you are fully sure that the actions are going to perform without any problems. Unless you're confident of the outcome of all actions, you should avoid using this action.

To turn off errors, you can set warnings to false prior to running a query and then set warnings to true immediately after running the query. It is imperative that you remember to turn the warnings back on. Leaving warnings off will prevent Access from warning you that there are unsaved changes should you modify something and forget to save it. With warnings on, Access will ask you if you want to save. With warnings off, Access will simply discard the changes without asking.

I strongly suggest setting the hourglass on whenever you turn warnings off. Should you sometime forget to turn warnings back on, the hourglass is a visual reminder that they are off.