Unit 11 Exercise . Forms
Exercise 1: Cars
1 Position yourself in the Forms tab in the Database window of the Cars database.
2 Double click on the Create form by using wizard option.
3 Select the Clients table from Tables/Queries list.
4 Click on the button to add all the fields to the form.
5 Click on the Next button to go to the wizards next screen.
6 Leave the Columnar option activated as the form's layout.
7 Click on the Next button.
8 Select the style of form you prefer.
9 Click on the Next button.
10 Type the title as Clients maintenance.
11 Click on the Finish button.
12 Close the form saving it as Client maintenance.
Follow the same steps as for part 2, substituting the names of the table and the tiltle.
You can practice moving down the controls and aligning them.
To perform this exercise we will use the form wizard to create almost the entire form, after this we will modify the design to create a combo box in order to see visualize the clients name together with their registration. This combo box will need to extract the corresponding clients name and surname, and registration. As all three of the fields are not in the same table we will need to create a query to have them together, and then base the combo box on this query.
1 Before starting to create the form, create the Cars with client query to have every car with the data of the corresponding client to later use as the source of the combo box.
After this we can start creating the form:
2 Follow steps 1 to 10 of part 2, substituting Clients for Services.
3 Before Finishing the wizard, check the Modify the form's desingn option.
4 Click on the Finish button. We enter into the form design window.
5 Click on the control corresponding the Car field.
6 Press the Del key to delete the control. We will delete it to substitute it with a combo box.
7 Make sure that the Controls wizard button on the Toolbox is activated (a dark line should appear around it). If it does not appear this way, click on it to make it active.
8 Click on the button.
9 Position the cursor in the place where you want to put the control, left clic and maintain the mouse button and drag it to the correct size. As we have the Control's wizard button activated a new window will open.
10 Select the I want the combo box to lookup the values in a table or query.
11 Click on the Next button.
12 Select the Cars with client query (check first Query option if not selected).
13 Click on the Next button. The next window will open.
We are going to select three fields, License, Client name, and Client surname.
14 Click on the License field, then click on the button do that the field is sent to the right.
15 click on the Client name field, then Click on the button do that the field is sent to the right.
16 Click on the Client surname field, then click on the button do that the field is sent to the right.
17 Click on the Next button twice (we do not want to vary the sort order).
In the next window we can vary the width of the columns on the list.
18 Adjust the width of the License field.
19 Click on the Next button.
20 Select the License field from the list.
21 Click on the Next button.
22 Select the Store the value in this field: option.
23 Select the car field from the list to the right of the option. In this way if the user selects a row from the list, the license corresponding this row will be stored in the Car field of the Services table.
24 Click on the Next button.
25 Change the title of the label if you want.
26 Click on the Finish button.
We see the result
27 Save the changes by clicking on the button.
28 Close the form.
Exercise 2: Clinic
Part 2 and 3:
1 Position yourself in the Forms tab in the Database window of the Clinic database
2 Follow the same steps as for part 2 of exercise 1, substituting the names of the table and the title.
To perform this exercise we will use the Doctors maintenance form created in the previous part, and we will add a subform so that each doctors admissions will appear.
1 Before starting to create the Entries per doctor form we will create the form that will serve as the subform source, we will name it Entries sub. Include in all fields of the Entries table and give it a Tabular distribution.
Next we can start creating the Entries per doctor form.
2 Position yourself in the Forms tab in the Database window of the Clinic database
3 Generate a form based on the Doctors table using the wizard, and in the same way that we have created all of our forms, select an In columns distribution.
4 Before Finishing the wizard, check the Modify the form's desingn option.
5 Click on the Finish button. We enter into the form design window.
6 Edit the size of the Detail section so that the subform fits.
7 Change the layout of the controls in order to leave them in the top part of the Detail section.
8 Click on the button .
9 Position the cursor over the place where we want to put the subform, clic and maintain the mouse button, and drag the contol to the correct size so that various Entries rows will fit.
10 Click on the Entries sub name in the first screen of the assistant (the form we created in step 1) you will see that the Use an existing form option is automatically activated. We could have not defined the Entries sub form previousely, and rather have selected the Use existing Tables and Queries option, but this way would leave us less freedom at the time of defining the subform.
11 Click on the Next button.
12 Type the name of the form as Entries subform. This is the name of the subform control that you have in this form.
13 Click on the Finish button.
14 We will now remove the control label as we dont need it to weigh our form down even more. click on the labeland press Del.
15 Click on the button to see the result.
As the two tables are related by the Doctor code field, Access has automatically linked the subform with the form in this field, and so only those admissions that have a doctor code in the active record of the principal form will appear.
16 Save the changes by clicking on the button .
17 Close the form.
Legal warning: Authorised on-line use only. It is not allowed the use of these courses in companies or private teaching centres.
© aulaClic. All rights reserved. Reproduction in any form whatsoever is prohibited. April-2006.