Turn delete object and action query confirmation messages on or off (2024)

By default, Access prompts you to confirm that you want to delete an object from the Navigation Pane or when you run an action query. You can turn these confirmation messages off if you prefer not to be prompted. If the messages are not appearing and you want to be prompted, you can turn them back on.

In this article

  • Turn off object deletion confirmation messages

  • Overview of action query confirmation messages

  • Control action query confirmation messages for a computer

  • Turn action query confirmation messages off for a database

  • Turn action query confirmation messages off for a specific set of tasks

  • Use a macro to turn the messages off and back on

Turn off object deletion confirmation messages

Important:If you use this setting to turn object delete confirmation messages off, Access will not display the messages on that computer when you delete objects from the Navigation Pane.

  1. On the File tab, click Options.

  2. On the left side of the Access Options dialog box, click Client Settings.

  3. On the right side of the Access Options dialog box, in the Editing section, under Confirm, clear the Document deletions check box, and then click OK.

Overview of action query confirmation messages

Action queries are a way to change the data in your database. An action query can append, delete, or update data, or make a new table using existing data. Action queries are very powerful, but that power entails some risk of unintended data changes. Because of the possibility of data loss, by default Access asks for your confirmation when you run an action query. This helps mitigate the possibility of unintended data changes.

Tip:To see what data an action query will effect, before you run the query, on the Home tab, in the Views group, click View, and then click Datasheet View.

If you prefer that Access doesn’t ask you to confirm action queries, or if Access isn’t asking for confirmation but you want it to, you can turn the messages on or off.

  • Control action query confirmation messages for a computer
    You can use a setting in the Access Options dialog box to set the default behavior for Access databases opened on a specific computer. If you use this setting to turn the messages off, Access will not display the messages under any circ*mstances. If you use this setting to turn the messages on, Access will display the messages unless they are turned off by a macro or by VBA.

  • Turn action query confirmation messages off for a database
    Choose this method to turn warnings off for a specific database when it opens. You use the SetWarnings action inside an AutoExec macro to turn the messages off. The database file must be trusted for this macro action to work; for more information about trusted databases, see the article Decide whether to trust a database.

  • Turn action query confirmation messages off for a specific set of tasks
    Choose this method to turn warnings off for the duration of a set of tasks and then turn them back on; for example, you might turn off the messages while a make-table query runs, and then turn them back on. You can use the SetWarnings macro action, and you can also use the DoCmd.SetWarnings VBA method. The database file must be trusted for this macro action to work; for more information about trusted databases, see the article Decide whether to trust a database.

Top of Page

Control action query confirmation messages for a computer

Important:If you use this setting to turn action query confirmation messages off, Access will not display the messages on that computer even for a database that contains a macro or module that turns the messages on.

  1. On the File tab, click Options.

  2. On the left side of the Access Options dialog box, click Client Settings.

  3. On the right side of the Access Options dialog box, in the Editing section, under Confirm, clear the Action queries check box, and then click OK.

Top of Page

Turn action query confirmation messages off for a database

You can use the SetWarnings action in an AutoExec macro to turn action query confirmation messages off for a database.

Important:If the database containing the macro is not trusted, the SetWarnings action won’t run. For more information about trust and databases, see the article Decide whether to trust a database.

Note:It is possible to bypass If there is already a macro named AutoExec, open that macro in Design view, and then perform steps 2 through 4 of the following procedure.

  1. On the Create tab, in the Macros & Code group, click Macro.

    Turn delete object and action query confirmation messages on or off (1)

  2. In the drop-down list at the top of the Macro Builder, select the SetWarnings action.

    • If you do not see the SetWarnings action listed, on the Macro Design tab, in the Show/Hide group, make sure Show All Actions is selected.

  3. Under the SetWarnings action, click the arrow next to Warnings On and select the option that you want.

  4. Click Save.

  5. In the Save As dialog box, type AutoExec.

  6. Click OK and then close the Macro Builder. The new macro will run the next time that you open the database.

For more information about how to create macros, see the article Create a user interface (UI) macro.

Top of Page

Turn action query confirmation messages off for a specific set of tasks

There are two basic ways to turn action query confirmation messages off for a set of tasks: by using a macro, and by using a VBA module. Either way, you use code to turn the warnings off, perform the set of tasks, and then turn the warnings back on. You attach the code to an event, such as the Click Event of a command button or the Open Event of a form.

You attach a module to an event, and when the event occurs, the module runs. For example, you might attach a module to the On Open event for a form. When the form opens, the module runs. The following procedure explains how to use the DoCmd.SetWarnings method in the On Open event of a form.

  1. Open the form in Design view.

  2. If the property sheet is not visible, press F4 to display it.

  3. Click the square at the top left of the form, just below the form’s object tab.

  4. In the property sheet, on the Other tab, make sure Has Module is set to Yes.

  5. On the Event tab, click the On Open event, and then click the build button (the ellipses next to the arrow).

  6. In the Choose Builder dialog box, do one of the following:

    • To use a VBA module, double-click Code Builder and follow the remaining steps in this procedure.

    • To use a macro, double-click Macro Builder, and then follow the steps in the procedure Use a macro to turn the messages off and back on.

  7. Type DoCmd.SetWarnings (WarningsOff), and then press ENTER.

  8. Enter the necessary code to perform the tasks that you want done with confirmation messages turned off.

  9. On a new line, type DoCmd.SetWarnings (WarningsOn).

  10. Close the VBA Editor, and save the form.

Use a macro to turn the messages off and back on

  1. In the drop-down list at the top of the Macro Builder, select the SetWarnings action.

    • If you do not see the SetWarnings action listed, on the Macro Design tab, in the Show/Hide group, make sure Show All Actions is selected.

  2. Under the SetWarnings action, click the arrow next to Warnings On and select No.

  3. Enter the necessary macro actions to perform the tasks that you want done with confirmation messages turned off.

  4. Below the last task action, select the SetWarnings action, then click the arrow next to the Warnings On and select Yes.

  5. Close the Macro Builder, save the macro, and then save the form.

Top of Page

Turn delete object and action query confirmation messages on or off (2024)

FAQs

Turn delete object and action query confirmation messages on or off? ›

For deleting a query in Access open the table in Datasheet view, select the fields (columns) or records (rows) that you want to delete, and then press DELETE. Important: The information in this article is intended for use only with desktop databases. You cannot use delete or update queries in Access web apps.

How do you DELETE an action query in Access? ›

For deleting a query in Access open the table in Datasheet view, select the fields (columns) or records (rows) that you want to delete, and then press DELETE. Important: The information in this article is intended for use only with desktop databases. You cannot use delete or update queries in Access web apps.

How to add criteria to DELETE records in Access? ›

Using a specific criteria in a delete query

Otherwise, the delete query removes every record in the table. Double-click the field that you want to specify as the criteria for deletion, enter one the criteria in the Criteria row of the query designer, and then clear the Show check box for each criteria field.

How to create a DELETE query in Access using two tables? ›

Create a Delete Query
  1. Click the Create tab on the ribbon.
  2. Click the Query Design button. ...
  3. Select the tables and queries you want to add and click Add.
  4. Click Close. ...
  5. Connect any unrelated tables. ...
  6. Click the Delete button on the ribbon.

How do I stop disabled mode from blocking a query? ›

To make the query work, you must enable the database content by indicating that you trust the database content.

Is a DELETE query an action query? ›

Answer. A DELETE query is an action query (SQL statement) that deletes a set of records according to criteria (search conditions) you specify. An action query is a query that makes changes to or moves many records in just one operation. There are four types of action queries: append, update, make-table, and delete.

What is the purpose of the DELETE query? ›

A DELETE query deletes entire records, not just data in specific fields. If you want to delete values in a specific field, create an update query that changes the values to Null.

How do I change the query type in Access? ›

On the Query Design tab, in the Query Type group, click Update. This procedure shows you how to change a select query to an update query. When you do this, Access adds the Update to row in the query design grid.

How do I DELETE records from my Access database? ›

For more information, see Guide to table relationships.
  1. Open the table in Datasheet View or form in Form View.
  2. Select the record or records that you want to delete. ...
  3. Press DELETE, select Home > Records > Delete, or press Ctrl+Minus Sign (-).

In what view do query results display? ›

Access displays the results of your query in Datasheet view. To make further changes to the query, click Home > View > Design View to switch back to Design view. Change your fields, expressions, or criteria and rerun the query until it returns the data that you want.

What happens to the unique ID field when a record is deleted? ›

Every record, regardless of entity type, has a unique identification value in its ID field which is generated at the time of record creation. That Record ID value will never change, even if the record is deleted and then undeleted.

What is a DELETE query with an example? ›

This is the basic syntax for using the DELETE query: DELETE FROM table_name WHERE condition of which row(s) to delete; If you want to delete one row from the table, then you have to specify a condition.

Which query allows you to delete records in a table? ›

The DELETE command is used to delete existing records in a table.

How do I hide warnings in Access macro? ›

You can use the SetWarnings macro action to hide the warnings and message boxes as well. Although the SetWarnings macro action can simplify interactions with macros, you must be careful about turning system messages off. In some situations, you won't want to continue a macro if a certain warning message is displayed.

How do I disable specific warnings in compiler? ›

You can hide specific compiler warnings for Visual Basic by editing the . vbproj file for the project. To suppress warnings by category, you can use the Compile property page. If you want to disable a warning in a specific part of a code file, use #Disable and #Enable directives.

How do I change disable mode in Access? ›

To stop Disabled Mode from blocking the query, you must enable the database content. You use the Options button in the Message Bar to enable the query. Enable the append query In the Message Bar, click Options. In the Microsoft Office Security Options dialog box, click Enable this content, and then click OK.

How do you stop code in Access? ›

Try pressing Ctrl+Pause/Break.

Top Articles
Latest Posts
Article information

Author: Rob Wisoky

Last Updated:

Views: 5982

Rating: 4.8 / 5 (48 voted)

Reviews: 95% of readers found this page helpful

Author information

Name: Rob Wisoky

Birthday: 1994-09-30

Address: 5789 Michel Vista, West Domenic, OR 80464-9452

Phone: +97313824072371

Job: Education Orchestrator

Hobby: Lockpicking, Crocheting, Baton twirling, Video gaming, Jogging, Whittling, Model building

Introduction: My name is Rob Wisoky, I am a smiling, helpful, encouraging, zealous, energetic, faithful, fantastic person who loves writing and wants to share my knowledge and understanding with you.