Switchboard Manager


When you open the Northwind sample database, the first thing you see is the switchboard shown in Figure 12.37. (I've assumed you've already told Access not to show the Welcome window again.) A switchboard is a fast way to perform your most common and useful Access tasks. As in the Northwind database, you usually want to display a switchboard at startup so you can get right to work. (I show you how to get Access to do that in the upcoming section "Displaying the Switchboard at Startup.")

Figure 12.37. A switchboard is an easy-to-use form for performing Access tasks.


Switchboards are especially helpful for new users who have little knowledge of the inner workings of Access and have no desire or need to contend with the Database window. In fact, if you have a switchboard, you can hide the Database window altogether. It's not the best form of security; but it does make it more likely that other users will work with only those objects you want them to.

Switchboards are also convenient timesavers for experienced Access users. They offer fast access to objects you use most often so you can get to work quickly.

Using the Switchboard Manager

From a construction point of view, a switchboard is a form composed almost entirely of command buttons that run macros. In early versions of Access, you had to build a switchboard from scratch, but now you can use the Switchboard Manager, available from the Tools, Database Utilities menu. For the most part, you can create your switchboard just by selecting options in its dialog boxes. A little knowledge of some simple macros is helpful in building switchboards.

From a theoretical or conceptual standpoint, the Switchboard Manager is not difficult to use. But it is can be confusing, and it's easy to get lost in it. As you work through the steps in the following example, pay special attention to the titles of the various dialog boxes; they can help you fix your position in the switchboard-making process. I've included notes after many of the steps, to let you know why you're doing what you're doing.

Often you'll use the main switchboard as a launch point for creating additional switchboard pages; the latter will contain the buttons for executing tasks. For example, the Main Switchboard could have a button to open the Products switchboard, where you could then open the Products report. (Don't worry if you don't understand what I'm talking aboutit will become apparent as you build a switchboard.)

Constructing a Switchboard

In the following example, you add two switchboard pages to the main switchboard. You then add buttons that are specific to the switchboard page.

1.

In the NiftyLionsChap12.mdb database, choose Tools, Database Utilities, Switchboard Manager. Click Yes when the Switchboard Manager asks if you'd like to create a switchboard.

2.

Click New in the Switchboard Manager dialog box.

3.

In the Create New dialog box, type Customers and click OK.

You've created the first of two switchboard pages that will be accessed from the main switchboard.

4.

Click New. Type Orders and click OK (see Figure 12.38).

Figure 12.38. In the Switchboard Manager dialog box, you see all of your switchboard pages.


You've created the second of two switchboard pages that will be accessed from the main switchboard.

5.

With Main Switchboard (Default) selected, click Edit.

6.

In the Edit Switchboard Page dialog box, click New.

You are now adding buttons to the Main Switchboard that will send you to the Customers and Orders pages.

7.

In the Edit Switchboard Item dialog box, enter Edit/Print Customer Data in the Text box. Keep the Go to Switchboard command. At Switchboard, open the drop-down list and choose Customers. Click OK.

You've created a button on the Main Switchboard that says Edit/Print Customer Data. When you click it, the Customers page appears.

8.

In the Edit Switchboard Page dialog box, click New.

9.

In the Edit Switchboard Item dialog box, edit Text to Edit/Print Order Data. Keep the Go to Switchboard command. At Switch-board, open the drop-down list and choose Orders. Click OK.

You've created a button on the main switchboard that says Edit/Print Order Data. When you click it, the Orders page appears.

Now you'll create buttons on each of the subsidiary switchboard pages to perform tasks.

1.

In the Edit Switchboard Page dialog box, click Close.

2.

In the Switchboard Manager dialog box, select Customers. Click Edit.

Note that the switchboard name is Customers. You're working on the Customers page.

3.

In the Edit Switchboard Page dialog box, click New.

Figure 12.39 shows all three dialog boxes you have been working with.

Figure 12.39. When you create a switchboard, keep a careful eye on which dialog box you're working in; it's easy to lose your bearings.


4.

In the Text box, change the text to Edit Customer Data. At Command, open the drop-down list and choose Open Form in Edit Mode. At Form, open the drop-down list and choose frmCustomersSwitch.

You created a button on the Customers page that will open the frmCustomersSwitch form so you can edit customer records.

5.

Click OK. In Edit Switchboard Page, click New.

6.

Edit Text to Return to Main Switchboard. In Command, keep Go to Switchboard. Open the drop-down list for Switchboard and choose Main Switchboard.

The Go to Switchboard command is convenient for returning to switchboards from other switchboard pages.

7.

Click OK. Click Close in the Edit Switchboard Page dialog box.

8.

In the Switchboard Manager dialog box, select Orders. Click Edit.

Now you'll add buttons to the Orders page.

9.

In the Edit Switchboard Page dialog box, click New.

10.

At Text, type Edit Order Data. For Command, select Open Form in Edit Mode. For Form, select frmOrdersSwitch. Click OK.

11.

In the Edit Switchboard Page dialog box, click New.

12.

Edit Text to Print Order Data. For Command, select Run Macro. For Macro, select mcrPrintOrdersReport.

The mcrPrintOrdersReport macro is a simple macro that opens and prints the first page of the Orders report. If you've read the previous section on macros, you should have no trouble understanding it. For our immediate purposes, simply note how you attached this macro to a button.

13.

Click OK. In Edit Switchboard Page, click New.

14.

Edit Text to Return to Main Switchboard. In Command, keep Go to Switchboard. Open the drop-down list for Switchboard and choose Main Switchboard.

15.

Click OK. Click Close in the Edit Switchboard Page dialog box. Click Close in the Switchboard Manager dialog box.

16.

Click Forms and double-click Switchboard to open it (see Figure 12.40). Assuming you haven't renamed the database, your own title will be NiftyLionsChap12.

Figure 12.40. The main switchboard of the switchboard you created.


17.

Click Edit/Print Customer Data.

18.

Click Return to Main Switchboard

You can see the usefulness of including buttons that return or send you to other switchboards.

19.

Click Edit/Print Order Data.

20.

If your printer is set up, click Print Order Data.

The first page of the Orders report prints.

21.

Close the Orders report and close the switchboard.

NOTE

When you create a switchboard, you also acquire a Switchboard Items table. For the most part, you can ignore it, and it shouldn't otherwise interfere with your work. But don't be surprised by its presence.


Displaying the Switchboard at Startup

The Startup dialog box, available from the Tools menu, controls how Access qlooks and acts when you open it. The options apply only to the current database.

You can use the Startup dialog box to display the Switchboard when Access opens (see Figure 12.41). From Display Form/Page, you open the drop-down list and choose Switchboard. If you want, you can also deselect Display Database Window.

Figure 12.41. You can use the Startup dialog box to open the switchboard when you open the database.


NOTE

There's another way to open a form and execute other actions when you open an Access database. Create a macro and include any actions you want performed in that particular database at startup. Save the macro and name it AutoExec. When you open the file, Access runs this macro. Note that the AutoExec macro runs after the Startup options have taken effect, so be careful about using both. If your only goal is to have the Switchboard displayed at startup, I think it's easier to use Display Form/Page in the Startup dialog box.





Hands-On Microsoft Access(c) A Practical Guide to Improving Your Access Skills
Hands-On Microsoft Access: A Practical Guide to Improving Your Access Skills
ISBN: 0321245458
EAN: 2147483647
Year: 2005
Pages: 169
Authors: Bob Schneider

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