You can make forms easier to use by adding buttons for common operations of, say,
- adding a new row
- deleting the currently displayed row
- closing the form
Adding a Button
To add buttons to an existing form you must open the form in Design View. At this point make sure that wizard capabilities are available – if necessary select the Use Control Wizards: (see below) to turn wizard capabilities on. To add a button you click the Button button:
Next, you click a location on the form where you would like the button to be placed. Click in the area labeled Form Footer and space will be added to the form’s design to accommodate the button.
Because Use Control Wizards is on, the system will take you through a series of prompts where you specify the nature of the button. You need to add three buttons to each form. Consider selecting/entering the following at the pertinent prompts:
|Add button||Record operations||Add new record||New Row|
|Delete button||Record operations||Delete a record||Delete Row|
|Close button||Form operations||Close form||Close|
A Course form in Design View with three buttons in the Form Footer section:
Anytime after creating a button you can switch to Form View to test your design. If some button is not working as you like then just switch back to Design View, delete the button and try again.
Adding a Label
A label is a control that holds text for display purposes only. By default, MS Access adds a label containing the table name in the Form Header area of the form.
To add a label you must click the Label control, then click (and drag for sizing) where you want the label placed. You can then type the content for the label and adjust its properties for formatting (e.g. font size, colour, ...).
Adding a Calculated Field
A calculated field is one that involves a calculation using existing fields; for instance to multiply a quantity and a unit price to get an extended price.
To add a control where a calculated value will be displayed you must click the Text Box control, then click (and drag for sizing) where you wish the control placed. You will see two controls placed in the form: a label and a text box. For the label one could enter Extended price, and in the text box you would enter a formula (e.g. for an extended price a formula would be: =[quantity]*[unitprice]).
Adjust the size and location of the controls as necessary. To do this can be a little tricky. To move a control you must select the control, and then click (and drag) the large dot in the control’s upper left corner:
To resize a control you must position the mouse so you can see a resizing indicator:
Open the Orders database (see databases for these notes) and create a form for OrderDetails. You will be able to incorporate the calculated field discussed above. Open your form in Form View and view the data to verify your calculated field displays properly.
Note that you can modify the properties of fields on a form. When you are in Design View for this form you can right-click a field and select properties – the first property on the Format tab is Format and, for this calculated field, you could choose Currency.
Open the Library database and create forms for each of Book, Loan and Member.