Lesson 2.14. Database Object Management
Figure 2-32. The Paste Table As dialog box
Figure 2-33. Right-click any database object to open a shortcut menu that lists different commands related to the object.
Not only can you view, open, and modify database objects (tables, queries, forms, etc.) from the Database window, you can also use it to cut, copy, paste, delete, and rename database objects.
Make sure you have the Database window open and click the Tables icon in the Objects bar.
One reason to copy a database object is that it's often easier to copy and use the design of an existing database object than it is to create a whole new object from scratch. For example, you might copy an Employees table so that you could create a new table using its structure.
You can use standard cut, copy, and paste procedures on any Microsoft Access database object in the Database window. That's rightthe same cut and paste stuff you already know how to do with text works with tables, queries, forms, pages, and reports!
Select the Employees table and click the Copy button on the toolbar.
On the surface nothing appears to happenbut Microsoft Access has copied the Employees table to the Windows clipboard. Move on to the next step and paste the copied Employees table.
Click the Paste button on the toolbar.
The Paste Table As dialog box appears, as shown in Figure 2-32. First you have to specify a name for the new table.
Type Fired Employees in the Table Name box.
You have several options when you paste a table objectyou can paste the:
Structure Only: Pastes only the structure or design of the table.
Structure and Data: Pastes the structure of the table and its data.
Append Data to an Existing Table: Adds the copied records to an existing table in the database.
For this exercise we only want to paste the structure of the Employees table.
Select the Structure Only option and click OK.
Access pastes the copied Employees table as a new Fired Employees table.
Note: You can also copy objects from one database to another using simple copy and paste commands. Copy the database object, start another session of Microsoft Access, and open the destination database. Click the Paste button to paste the copied object into the other database.
Double-click the Fired Employees table.
Notice that there aren't any records in the Fired Employees table because you specified that you only wanted to copy the structure of the Employees table.
Close the Fired Employees table.
You can also rename a database object from the Database window. Here's how:
Right-click the Fired Employees table, select Rename from the shortcut menu, type Previous Employees and press Enter.
The "Fired Employees" table is now named "Previous Employees." Finally, here's how to delete any database object.
Select the Previous Employees table and press the Delete key. Confirm the deletion by clicking Yes.
Whenever you're unsure or curious about what you can do with a database object, try right-clicking it. A shortcut menu, as shown in Figure 2-23, will appear with a list of commands related to the database object. Table 2-6 contains some of the commands you'll see on the database object shortcut menu.
Tip: Intermediate and advanced Access users use a standard naming convention to make it easy to identify database objects. You are strongly encouraged to use the following naming convention as well, as it makes it easier to refer to database objects in expressions, macros, and VB procedures.
Table 2-6. Object Shortcut Menu Commands
Opens the selected object.
Opens the selected object in Design view so that it can be modified.
Sends the selected object to the default printer.
Displays how the selected object will appear when it is printed.
Cuts/moves the selected object to the Windows clipboard.
Copies the selected object to the Windows clipboard.
Saves the selected object to a new object within the current database.
Exports the selected object to another Access database or to a different file format.
Sends the selected object to an e-mail recipient via Microsoft Outlook.
Add to Group
Adds the selected object to Favorites or a new group.
Creates a shortcut on the Windows desktop to the selected object.
Deletes the selected object.
Renames the selected object.
Displays the properties and settings for the selected object.
TO CUT/COPY AND PASTE A DATABASE OBJECT:
SELECT THE DATABASE OBJECT.
CLICK THE CUT BUTTON ON THE TOOLBAR.
CLICK THE COPY BUTTON ON THE TOOLBAR.
CLICK THE PASTE BUTTON ON THE TOOLBAR, ENTER A NAME FOR THE NEW OBJECT, AND CLICK OK.
TO RENAME AN OBJECT:
TO DELETE AN OBJECT: