You probably won’t need to delete an entire table very often. However, if you set up your application to collect historical information-for example, total product sales by year- you’ll eventually want to delete information that you no longer need. You also might want to delete a table if you’ve made extensive changes that are incorrect and it would be easier to delete your work and restore the table from a backup.
To delete a table, select it in the Navigation Pane and press the Delete key (or click the Delete command in the Records group on the Home tab of the Ribbon). Access 2007 opens the dialog box shown in Figure 5–7, which asks you to confirm or cancel the delete operation.
Figure 5–7: This dialog box gives you the option of canceling the deletion of a table.
|Inside Out-Access Is Forgiving When You Delete Something by Mistake|| |
Even if you mistakenly confirm the deletion, you can click the Undo command on the Quick Access Toolbar to get your table back. In fact, you can undo up to the last 20 changes that you made in a window-either in the table’s Design view or in the Navigation Pane. However, after you save changes to a table design, you will not be able to undo those changes.
|Inside Out-Using Cut to Move an Object to the Clipboard|| |
You can use the Cut command in the Clipboard group on the Home tab on the Ribbon to delete a table. This method moves a copy of the table to the Clipboard. After you close the database in which you’ve been working, you can open another database and paste the table from the Clipboard into it.
If you have defined relationships between the table you want to delete and other tables, Access 2007 displays another dialog box that alerts you and asks whether you want to also delete the relationships. If you click Yes, Access deletes all relationships between any other table and the table you want to delete and then deletes the table. (You can’t have a relationship defined to a nonexistent table.) Even at this point, if you find you made a mistake, you can click Undo on the Quick Access Toolbar to restore both the table and all its relationships.
When you undo a table deletion, Access 2007 might not restore all the previously defined relationships between the table and other tables. You should verify the table relationships in the Relationships window.