Create a new warning for Access record deletion

If you have started to glaze over the message you get whenever you delete an Access record, you may want to record a message that is more likely to grab your attention. Mary Ann Richardson shows you how.

When you delete a record in a form, Access displays a standard message box, asking you to confirm the deletion. But you are not limited to this message; you can create your own message text to include a reminder or other information. Follow these steps:

  1. Open the database, and click Macros under Objects.
  2. Click New.
  3. Right-click the macro title bar and select Conditions. (In Access 2002, click the Conditions button in the Macro toolbar.)
  4. Click in the first Conditions cell and enter the following:
    MsgBox("Do you really want to delete the record?"273,"Delete")<>1
  5. Click in the Action cell and enter CancelEvent.
  6. Click in the next Condition cell.
  7. Enter an ellipsis (...).
  8. Press [Tab].
  9. Enter StopMacro.
  10. Click in the next Action cell.
  11. Enter Keystrokes.
  12. Under Action Arguments, click in the Keystrokes box and click [Enter].
  13. Close and save the macro as ConfirmDelete.
  14. Open the form in design view, then right-click the form and select Properties.
  15. On the Event tab, click in the On Delete property box and select ConfirmDelete.

You can modify the message in step 4 to be any text you like. The macro will execute before the system actually deletes the record.

Miss a tip?

Check out the Microsoft Access archive, and catch up on our most recent Access tips.

Help users increase productivity by automatically signing up for TechRepublic's free Microsoft Office Suite newsletter, featuring Word, Excel, and Access tips, delivered each Wednesday.

Editor's Picks

Free Newsletters, In your Inbox