Using the Switchboard Wizard

By now, the Plants database contains dozens of objects: tables, queries, forms, and reports . Right now, you can find any of these objects by going to the Database window, selecting the proper shortcut, and then locating the object you want. But what if you're sharing the database with someone else? The Database window isn't the friendliest possible way to organize things. It's efficient, and it shows you everything, but it doesn't offer you any guidance for finding the important objects.

Over the years , Access developers have come up with several ways to tackle this problem. One of the most popular organizational devices for Access databases is the switchboard form. Figure 15.1 shows the switchboard form from the Northwind sample database.

Figure 15.1. The switchboard form in the Northwind sample database.

graphics/15fig01.gif

The Northwind sample database contains more than 100 objects. The switchboard form comes up automatically when you open the database and gives you buttons to open just the most important items. You can see that this is a much friendlier interface for new users than the Database window.

Note

graphics/nman.gif

You can download the Chapter 15.mdb sample file, which is inclusive of all the examples in this chapter, from http://www.quepublishing.com/. If you want to follow along with our examples, download Chapter 14.mdb .


Building Your First Switchboard

Fortunately, adding a switchboard to your own database is easy because Microsoft includes a Switchboard Manager in Access. (A manager is similar to the wizards you've been using throughout this book.) You'll use this tool now to create a switchboard for the Plants database. Follow these steps:

  1. Launch Access and load the Plants database.

  2. Select Tools, Database Utilities, Switchboard Manager.

  3. Because this is the first time you've loaded the Switchboard Manager in this database, Access asks whether you'd like to create a switchboard. Click Yes.

  4. The Switchboard Manager opens, as shown in Figure 15.2. As you'll learn, you can actually have more than one switchboard in a database. When you start, the Switchboard Manager only creates the Main Switchboard (Default) for you. Click Edit to open the Edit Switchboard Page dialog box.

    Figure 15.2. The Switchboard Manager creates a default switchboard the first time you run it.

    graphics/15fig02.gif

  5. The Edit Switchboard Page dialog box shows you all the items on a particular switchboard. The main switchboard doesn't have any items yet. Click New to open the Edit Switchboard Item dialog box.

  6. Enter Catalogs for the text. Select Open Form in Edit Mode as the command; then select the Catalogs form. Figure 15.3 shows the filled in Edit Switchboard Item dialog box. Click OK to close the Edit Switchboard Item dialog box.

    Figure 15.3. Creating a switchboard item.

    graphics/15fig03.jpg

  7. Click Close to close the Edit Switchboard Page dialog box.

  8. Click Close to close the Switchboard Manager.

  9. Click the Forms shortcut in the Database window.

  10. Double-click the new Switchboard form to open it. Figure 15.4 shows the new switchboard.

    Figure 15.4. A new switchboard with a single button.

    graphics/15fig04.gif

  11. Click the Catalogs button, and the Catalogs form opens.

Congratulations! You've built your first switchboard. Table 15.1 lists the various commands you can select on the Edit Switchboard Item dialog box.

Table 15.1. Commands Available for Switchboard Items

Command

Meaning

Go to Switchboard

Opens another switchboard.

Open Form in Add Mode

Opens a form without showing existing records, so that you can add new data.

Open Form in Edit Mode

Opens a form showing existing records, so that you can edit data (you can also add data in this mode).

Open Report

Opens a report in preview mode.

Design Application

Opens the Switchboard Manager.

Exit Application

Closes the database.

Run Macro

Runs a macro. You'll learn more about macros later in this chapter.

Run Code

Runs Visual Basic for Applications (VBA) programming code. We don't cover VBA in this book.

Note

graphics/nman.gif

You'll learn how to make the switchboard open automatically when you load the database later in the chapter, in the "Setting Startup Options" section.


Editing a Switchboard

One of the benefits of the Switchboard Manager is that it can be used repeatedly on the same switchboard. If you think of a change you'd like to makeadding a new item, editing an item, deleting an itemyou can just open the Switchboard Manager again. You don't have to throw away your previous work. In this section, you'll make some changes to the main switchboard for the Plants database. Do the following:

  1. Make sure the main switchboard (form) is closed.

  2. Select Tools, Database Utilities, Switchboard Manager.

  3. In the Switchboard Manager dialog box, select Main Switchboard (Default) and click Edit.

  4. In the Edit Switchboard Page dialog box, click New.

  5. In the Edit Switchboard Item dialog box, enter View Plants for the text. Select Open Form in Edit Mode as the command, and select the Plants form. Click OK to close the Edit Switchboard Item dialog box.

  6. In the Edit Switchboard Page dialog box, click New.

  7. In the Edit Switchboard Item dialog box, enter View Plantings for the text. Select Open Form in Edit Mode as the command, and then select the Plantings form. Click OK to close the Edit Switchboard Item dialog box.

  8. In the Edit Switchboard Page dialog box, click New.

  9. In the Edit Switchboard Item dialog box, enter View Types for the text. Select Open Form in Edit Mode as the command, and then select the Types form. Click OK to close the Edit Switchboard Item dialog box.

  10. Select the View Types item on the Edit Switchboard Page dialog box. Click Move Up twice to relocate this item above the View Plants item. You can use the Move Up and Move Down buttons to arrange the switchboard any way you like.

  11. Select the Catalogs item and click Edit . Change the Text to View Catalogs ; then click OK.

  12. Click Close to close the Edit Switchboard Page dialog box.

  13. Click Close to close the Switchboard Manager.

  14. Double-click the Switchboard form to open it. Figure 15.5 shows the edited switchboard.

    Figure 15.5. The main switchboard after editing.

    graphics/15fig05.gif

Besides adding new items to a switchboard and editing existing items, you can delete items that you no longer need. Just select the item on the Edit Switchboard Page dialog box and click Delete .

Adding a Second Switchboard

Switchboards are a good way to organize things, but they can be overdone. What happens when you go from four items on a switchboard to fourteen or forty? The switchboard can become just as overwhelming as the Database window. Access provides a way to handle this by letting you create nested switchboards . Follow these steps:

  1. Make sure the main switchboard is closed.

  2. Select Tools, Database Utilities, Switchboard Manager.

  3. In the Switchboard Manager dialog box, click New.

  4. Name the new switchboard Reports and click OK.

  5. In the Switchboard Manager dialog box, select the Reports switchboard and click Edit.

  6. In the Edit Switchboard Page dialog box, click New.

  7. In the Edit Switchboard Item dialog box, enter Catalog Report for the text. Select Open Report as the command, and select the CatalogsAuto report. Click OK to close the Edit Switchboard Item dialog box.

  8. In the Edit Switchboard Page dialog box, click New.

  9. In the Edit Switchboard Item dialog box, enter Plant Report for the text. Select Open Report as the command, and select the Plants report. Click OK to close the Edit Switchboard Item dialog box.

  10. In the Edit Switchboard Page dialog box, click New.

  11. In the Edit Switchboard Item dialog box, enter Type Report for the text. Select Open Report as the command; then select the Types report. Click OK to close the Edit Switchboard Item dialog box.

  12. Click Close to close the Edit Switchboard Page dialog box.

  13. In the Switchboard Manager dialog box, select the Main Switchboard (Default) and click Edit.

  14. In the Edit Switchboard Page dialog box, click New.

  15. In the Edit Switchboard Item dialog box, enter Reports for the text. Select Go to Switchboard as the command; then select the Reports switchboard. Click OK to close the Edit Switchboard Item dialog box.

  16. Click Close to close the Edit Switchboard Page dialog box.

  17. Click Close to close the Switchboard Manager.

  18. Double-click the Switchboard form to open it.

  19. Click the Reports button, and the switchboard form changes to show the report items. Note that Access keeps only the most recent switchboard visible.

  20. Click the Plant Report button to preview the Plants report, as shown in Figure 15.6.

    Figure 15.6. Opening a report from a switchboard.

    graphics/15fig06.jpg

Tip

graphics/tman.gif

One good way to decide when to split off a second switchboard is to follow the "seven- plus-or-minus -two" rule. People can comfortably keep from five to nine things in mind. When you get up to seven switchboard items, consider splitting off a second switchboard.


Customizing the Switchboard Form

As you probably already know, the switchboard is a form, just like any other form. In fact, the Switchboard Manager uses programming techniques to display all the switchboards using a single form, no matter how many you define. Because it's a form, this switchboard can be customized just like any other form. Here's an example of how you can personalize the switchboard form a bit:

  1. Click the Forms shortcut in the Database window.

  2. Select the Switchboard form. Then, click the Design button on the Database window toolbar.

  3. Select View, Properties to display the Properties window if it's not already showing.

  4. Select the Label control at the top of the switchboard. Change its Caption property to My Garden Database .

  5. You may notice a second gray label behind the white label you just changed. Select Label2 from the combo box at the top of the Properties window to select it. Change the Caption property of this label to My Garden Database as well.

  6. Click in the empty area to the left of the switchboard buttons. In the Properties window, you'll see that this is an Image control named Picture. Click in the Picture property, and then click the builder button to browse for a picture. Select a picture file, such as coneflower.bmp , and click OK.

  7. Select File, Save to save your changes.

  8. Close the Switchboard form.

  9. Double-click the form to open it in regular form view. Figure 15.7 shows the customized form.

    Figure 15.7. A customized switchboard.

    graphics/15fig07.jpg

  10. Click the Reports button. You'll see that your customizations remain visible even though the choices in the switchboard change.



Absolute Beginner's Guide to Microsoft Office Access 2003
Absolute Beginners Guide to Microsoft Office Access 2003
ISBN: 0789729407
EAN: 2147483647
Year: 2002
Pages: 124

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net