Access Switchboard Forms
Many people overlook the switchboard feature of Microsoft Access but it
does provide a very quick and easy front-end for a simple database system.
A switchboard is a form which acts as a menu to the rest of your database.
It has a number of buttons, each of which leads to another form, another
switchboard or to a simple command like running a report. The Access
Switchboard Manager is a wizard which lets you build a simple hierarchy
allowing the user to navigate between the main areas of the application.
The example illustrated here is the front-end to our enquiry-tracking
database. This application records enquiries from clients and the names of
the people who made these enquiries. The main switchboard lets the user go
to the Client, Enquiry or People switchboards and work with those areas
of the database or to go to the Reports switchboard and run various
reports. The database application is much larger than this and the main
body is full of VBA code providing links between forms, automating common
tasks and validating data entry but the entry point to the whole system
was built as a simple set of switchboards with the wizard.
Creating a switchboard
Microsoft give us a wizard, the Switchboard Manager, to create and modify
switchboards. This tool is in different places in different versions of
Access. In Access 97 it is under Add-ins on the Tools menu, in Access XP
it is under Database Utilities on the Tools menu.
A rather worrying dialog appears the first time that you open the
Switchboard Manager:
Pay no attention to the warning icon and just click
.
The Switchboard Manager will appear with a single default entry named
.
Click the
button and change the
to something more suitable to your own database. The word "(Default)"
always appears in the manager window to show you which switchboard will
appear first. It doesn't appear on screen in your application.
Adding new switchboards
Like any Wizard, the Switchboard Manager asks you to select from a series
of options at every step as it leads you through the process. This makes
getting started a little difficult because you can't add anything to the
main switchboard until that item already exists in the switchboard system.
The first thing to do then is to add all the subsidiary switchboards that
you are going to need. Click the
button and enter the name of a new switchboard when the
dialog appears. Keep doing this
until you have all the second-level switchboards that you are going to
need. In our system we added switchboards named Client, Enquiry, People
and Reports.
Once these lower level switchboards exist you can go back to your main
switchboard and start adding entries to it. Click the
button then make changes to the
form that appears:
The
entry will appear saying "New Switchboard Command". Change this to
the wording you want the user to see. Leave the
as "Go to Switchboard" and pick
the switchboard that you want from the dropdown list.
This dropdown list is the reason why you have to define the lower-level
switchboards before you can finish the design of the main one. It's
annoying but it does force you to spend a little time thinking about the
structure of the application before you start working on it.
Adding forms
As with the lower-level switchboards, the forms have to exist before the
wizard will let you add them to the switchboard structure. If the form
exists then the Switchboard Manager gives you two options in the dropdown
list of commands:
and
.
Splitting the functions like this gives a consistent appearance to the
whole system. Users will always see similar pages in front of them. In our
example the Clients option leads them to a switchboard offering "Add
Client" and "Edit Client" and a couple of more complex options. The
"Enquiry" page looks much the same.
Navigation
The structure created by the Switchboard Manager does not automatically
give you a way of going back up the tree. Remember to add a "Return to
main switchboard" entry after you've added the entries for forms and
reports on each switchboard. The main switchboard needs a different
approach to let the user leave the application and close the database.
Select the main switchboard on the Switchboard Manager dialog. Click
as usual to add a new entry but select
from the dropdown list of commands.
Improving the appearance of the switchboard
Despite the number of different buttons and captions you will see as you
test the switchboard there is really only one switchboard form in the
database. The changes to its buttons and captions are made by VBA
program code. All this happens automatically and it means that you can get
a consistent style for your entire application by just modifying this one
master form.
Once you have set up your switchboards you can go to the Forms tab of the
Database Window and edit the Switchboard form that you find there. Its
default appearance appears to be plain turquoise but if you investigate
then you will find that it is made up of a number of components:
HorizontalDividingLine
|
The engraved line across the form.
|
HorizontalHeaderBox
|
A rectangle across the top of the screen surrounding the caption.
|
Label1
|
The caption in the turquoise box.
|
Label2
|
The shadow of the caption - please delete this if you have any
sense of style.
|
Option1..8
|
You can move these buttons or change their appearance but don't delete
or rename them.
|
OptionLabel1..8
|
These too must not be deleted or renamed because the VBA program code
refers to them.
|
Picture
|
Fills the left-hand side of the form.
|
VerticalShadowBox
|
The dark border between the left and right-hand sides.
|
A few minutes work leaves you with a form which looks a lot better:
All that I have done is to add a picture, remove Label2 and the
VerticalShadowBox, change some colours and the styles of the
OptionLabels and make the buttons a bit bigger.
The only unusual feature here is the icon on the Exit button. It's
possible because the main switchboard is the only form that has
five buttons on it. I added the exit icon to the fifth button of the
eight on the Switchboard form knowing that it would only ever be
visible on this one form.
Switchboards are not perfect as a user interface but they work and
the wizard lets you set them up very quickly. If you are writing something
that will only be used by yourself or by a few people in your department
then switchboard forms are very effective.
|