Tutorial 11: Creating a Front end menu
This tutorial takes you through the process of:
- creating a simple menu
- formatting the menu, and
- adding command buttons to the menu.
To do the activities in this tutorial, you’ll need a copy of the Get Fit database (get_fit_ot.mdb) that you used in Tutorial 10. If you don’t already have it, download the Get Fit database from the list of Tutorial downloads in the Research section.
You could try practising these steps in another test database of your own, but you’ll need a database with at least some existing tables and forms, because the macros operate on existing objects in the database.
Step 1: Create the menu on a blank form
The first step in creating a menu form is to create a blank form. (You can use several methods to do this). Here’s one method:
1Select the Forms object from the Database Window, and click New
A New Form dialog box should appear, similar to the one shown below:
New Form dialog box
2Select the Design View method and click the OK button.
Note: Do not select any table or query for the form as you have done in the past when creating forms — you want a blank form for your menu.
3Make sure that the Toolbox is displayed. If it is not visible, click on the Toolbox button on the Access toolbar or use the select View/Toolbox from the menu.
New Form in Design View
Check the magic wand is on
The button on the toolbox that looks like a magic wand is for turning the Wizard feature on or off. Occasionally people learning in this environment accidentally turn it off. If you do this, any of the activities below that normally activate a Wizard won’t work, and you’ll be very confused. The Wizard is on by default. So now, if a Wizard doesn’t activate, you’ll know what to check!
Step 2: Format the menu form
1Resize the detail section of the form so that it is large enough for a title and any buttons that you need. (Drag the bottom right corner of the grey tile area).
2Change the background colour of the form through the Form Properties as follows:
- right click the form where you see the grey tiles
- select Properties from the drop down menu
- select the Format tab
- choose Back Colour – once you click in the text box for Back colour, you’ll notice three small dots to the right of the box as in the figure below (the ‘build’ button)
- click the build button – it will display a standard Colour selection dialog
- select the colour you want
Changing the background colour of the form in the Section Detail properties
Step 3: Add labels and images to the menu
1Use the Label tool (Aa) to add a heading and any other text you want to the front end menu.
2Format the labels using the Format toolbar.
3You can also view or changeproperties of the labels or (other controls you put on the Form) as follows:
- Right click the label
- Select Properties
- Select the Format tab
- Scroll to the property of interest to view and/or change it.
4You can also add clip art and/or other graphics to the menu – you might want to add a Company logo, for example. Move your mouse over the various tools in the toolbox, and you should easily find the correct tools for this. After selecting the appropriate tool, click and drag inside the menu. You should then be able to browse to find the graphic you want.
Step 4: Add buttons to the menu
Here’s how you can create the buttons that will run macros and hence allow quick access to various objects.
1Find and click the Command Button tool on the Toolbox.
2Draw a command button onto your form.
The Command Button Wizard opens.
3Select the category and action you want the button to perform (see figure below).
Command Button Wizard - selecting the button's action
The figure above shows the selection of Form Operations and Open Form. Whatever you select in this dialog determines what the next steps in the Wizard will be. In the steps that follow, we use the common example of opening a form.
4The next screen (not displayed) allows you to select the object on which to perform the action, such as a client form. As we have just said, this depends on the choices you made in the previous screen.
Select an appropriate object, then click Next to move to the next dialog.
Remember, if you are working with an empty database there won’t be any objects to select from! Also, don’t attach subforms to buttons as they are part of other forms.
5The next dialog asks whether you want to find specific information. In most cases you would choose Open a Form and show all records.
6The next screen allows you to enter the text yo want displayed on your button or choose a picture as shown in the figure below.
Command Button Wizard - Choose Text or Picture dialog box
Note: When selecting pictures you can be use another Microsoft image or any other bitmap on your system.
7Clicking Next again allows you to give your button a meaningful name, eg btnNewClientForm
8Click the Finish button to end the Wizard and create the button.
The button won’t work in design view – you’ll need to save your form and switch to Form view to test it, so:
9Save your form by using the Access File/Save menu or the Save button on the toolbar and give it a name like frmFrontEnd.
10Switch to Form view and click the button to check that it works.
Step 5: Format buttons
You can move, resize and otherwise format the buttons the Wizard creates.
1Switch back to design mode.
2Select and drag the button to a new size or position.
3Use the Format toolbar to change some of the button’s properties.
4Right Click the button, and select Properties. You can change any setting for the button here, even the picture you used. (See figure below.)
Command Button Properties dialog box
You need to save the form again after making any changes, and test the form and button. First, close it, and select the front end form from the database window. Click any buttons you have created.
Now we’ll give you a real menu to create.
Practice activity
In this activity you’ll create a front-end menu.
Step 1: Creating the menu and buttons
Open the Get Fit database and create a front end menu for the existing forms. Call your menu form frmFrontEnd.
Here’s a sample layout that you can use.
Sample front end menu form
Create appropriate buttons for a user to enter and edit data using the existing forms.
Using appropriate form names
During the activity you will have noticed how important it is to give all objects (forms in this case) unique and meaningful names. Can you imagine seeing just the names, form1, form2 and so on, in the forms list? You may get by if you have just created the database but what about in a year or more when you go back to revise the database? Or when you make another fifteen databases for completely different organisations? Or when someone else takes over from you supporting the database because you leave the organisation?
Importance of testing
It is just as important to test that each of the buttons works as expected since this is what your client will see. Try out different combinations to produce any errors before the client gets them in a production environment. Think about how you would feel if you were the test subject and had to find the faults in something you were using for work.
One important thing to remember, is that you must use different names for your buttons. If you create a second button with the same name, this will cause an error, and none of the buttons will work!
Step 2: Integrate the forms
Now add buttons to the other forms as follows:
1Open each of the existing forms in Design mode, (not your front end menu form) and add a button to close the form. (Use the Close From action from the Form Operations category.)
2Try out different pictures and text on the buttons.
3Test that the Close buttons work correctly, using you front end menu form.
Feedback
Once again testing is important - you need to completely test all aspects of the database system you are working on. Testing just a sample to see if you are ‘setting up things correctly’ can lead to faults creeping in that will not get seen until your client has the product and your reputation may suffer.
1
2005