102
3.5.2 Add commands to the menu list
As an example, we will add two commands to the Stays
menu: One that opens the FindStay screen and one that
cancels (deletes) a stay.
1. Select the Commands tab in the customize window
and the category All Forms (Figure 3.5C).
This category gives access to commands that open an
existing form. You see the existing forms to the right.
2. Select frmFindStay and drag this command to the
Stays menu heading. Wait a moment for the Stays
menu to unfold so that you can place the command
on the menu list.
3. Right-click the command and give it the name
Show FindGuest screen and the style Text Only.
The right-click allows you to do many other things to
this command. You can assign an icon to it and edit the
icon. (This is more useful when you design toolbars
and toolboxes rather than menu bars.) If you click
Properties at the bottom of the list, you can determine
which action the command shall perform when se-
lected. In our case, we use the built-in action Open a
form.
Add the CancelStay command
4. Select the category File and the command Custom.
(This is the only command that doesn't build on an
existing command.) Drag this command to the
Stays menu and position it properly relative to the
other command on the menu.
5. Right-click the command and set its name to
Cancel Stay.
The Custom command has no built-in action. In its
property box, we will later add a call to a Visual Basic
function (section 5.7) that cancels the stay.
6. Close the Customize window and try out the com-
mands. The ShowFindGuest command should ac-
tually work, while the CancelStay does nothing at
present.
You may add all the other menus and commands at this
stage to complete the mockup, but better spend your
time doing it for your own design project.
3.5.3 Attach the toolbar to a form
You can attach a toolbar to a form so that it is shown
only when this form is in focus.
7. First hide the Hotel menu: Right click any toolbar
to open the customize window. On the Toolbars
tab, find the Hotel menu at the end of the list. Re-
move the check mark and close Customize.
8. The Hotel menu is not visible anymore. Now open
frmFindStay in Design view. In the form's prop-
erty box, select the Other tab. Set the Menu Bar
property to Hotel and close the form.
When you now open frmFindStay in user mode, the
Hotel menu will be visible and it will have replaced
Access's standard menu. Open frmStay too and switch
the focus back and forth between the two forms. The
menus will change accordingly.
If you like, you can make another toolbar and give it
the type Toolbar. Then attach it to frmStay through the
Other-tab, but make it the Toolbar of frmStay rather
than the Menu Bar. Open both forms in user mode and
switch the focus back and forth. Notice that when
frmStay is in focus, its toolbar overwrites Access's
standard toolbar. When frmFindStay is in focus, its
menu bar overwrites Access's standard menu bar.
3.5.4 Startup settings - hiding developer
stuff
When the system is finished, the user should not see all
the Access menus, the database window for selecting
and creating forms, etc. It may be necessary to hide all
of this already in the mockup. Here is how to do it:
9. Select Tools->Startup. You now see the startup
settings (Figure 3.5D).
10. Change these settings: Application Title = Hotel
system (the user sees this name in the title bar in-
stead of the name Access). Menu bar = Hotel (the
user sees this menu at the top of the screen). Dis-
play Form/page = frmFindStay (the user sees this
form on the screen initially).
11. Hide the standard things: Full menus and Database
window.
This will give the correct view for a mockup. When
you later have a functional system, you should disable
most other things too, for instance built-in shortcut
menus (right-click menus) and special keys, for in-
stance F11 to open the database window.
12. Close the database and open it again. You should
now see the naked application window with only
the FindStay window and the hotel menu.
Help! How do you get it back to normal so that you
can work as a developer? You cannot even change the
startup settings anymore. Of course there is a solution:
13. Close the hotel system window again. Now hold
down Shift while you open it. Keep Shift down
until it is completely open. (In Access 2003 this
includes answering about unsafe files.)
The window looks again the developer way, and you
can change the startup settings. You might leave them
in the final user version and remember to use Shift
every time you are working as a developer. My experi-
ence is that this is too cumbersome and you forget
48
3. Access-based user interfaces