| Step by step exercise. Designing forms |
|
Objective. |
|
To learn how to modify a form design.
|
|
Open the Classes.mdb database. We are going to modify the design of the Students columnar form. 1 Position yourself in the Forms tab in the Database window. 2 Click on Students Columnar form. 3 Click on the
1 If the Form design bar is not visible then drop down the View menu, Toolbars, and Form design option. 2 If the Toolbox
is not open click on the We are going to add todays date in the header of the form. For this we need to add a text box as it will contain a variable value. 3 Click on the 4 Position the cursor in the area where we want to put the date, left clic and maintaining the mouse down, drag the control to the correct size, and let go of the mouse button. 5 Click inside the control and type = date(), date() is the funtion that returns the system date. The = symbol is so that Access knows that what follows is a function or an expression that needs to be calculated. Now we will remove label as we do not need it and it only burdens our forms more. 6 Click on the label. 7 Press the Del key.
1 Click on the control that we have created so that it stands out. 2 Move the cursor over the size controller
to the right of the control untill the cursor takes the 3 Maintaing the mouse button depressed, drag it to the right, you are now extending the control. 4 Try the same with other size controllers until the field is the size you want.
1 Click on the control corresponding the course field, it will remain selected. 2 Press the Del key. The control and its label will disappear.
1 Make sure that the control wizard
button 2 Click on the 3 Position the cursor in the area where we want to create the control, and then click and go drag the control to the correct size. As we have the control wizard button activated the wizards window will open. 4 Select the I want the combo box to look up the values in a table or query option. 5 Click on the Next button. 6 Select the Courses table as we want all the courses created in this table to appear in the list. 7 Click on the Next button, the next window will open. We are going to select three fields: Course Code, Course Name, and Hours. 8 Select Course
code and click on the 9 Click on the 10 Clic again on the 11 Click on the Next button. In the next window we can order the list. 12 Select Course Name from the first box 13 Click on the Next button. In the next window we can vary the width of the columns in the list. In the list you may see various columns, but when we select a row from the list we can only collect the value of one column, this is the key column. In our example we want the Course Name and the Hours to appear so that it will be easier for the user to select the course, but it will only collect the course code in order to place it in the Course or Students field and so the Course code is the key column. 14 Uncheck Hide key column option. We see how the Course code column appears. And then check it again. 15 Make the Course name column wider, and make the Hours column narrower. 16 Click on the Next button. 17 Select Course Code 18 Check Store that value in this field: option. 19 Select the Course field from the drop down list that appears to the right of the option. In this way when a user selects a row from the list, the course code corresponding this list will be stored in the Course field of the Students table. 20 Click on the Next button. 21 Change the name of the label if you want. 22 Click on the Finish button. We see the result. 23 Click on the 24 Assign the course codes seen below to the students. Observe how when we are in the combo box we can drop down the list and select the course or begin to type the name of the course and the first course that corresponds the first three letters written will appear.
1 Return to design
view by clicking on the 2 Select the combo box by clicking on it. 3 Open the Properties
box by clicking on the 4 Look for the Column Heads property and put Yes by for example double clicking on it. 5 Click on the 6 Drop down the combo box and observe how a header now appears with the names of the fields that form the columns.
1 Make sure that the control wizard
button 2 Click on the 3 Position the cursor in the area that we want to move the control to, and without letting go drag the control to the correct size, then let go of the button. As we have the control wizard button activated the wizard's window will open. 4 Select the I want the list box to look up the values in a table or query. 5 Click on the Next button. 6 Select the Courses table as we want all the courses created in this table to appear in the list. 7 Click on the Next button, the next window will open. We are going to select three fields:Course Code, Course Name, and Hours. 8 Select Course
code and click on the 9 Click on the 10 Clic again on the 11 Click on the Next button. In the next window we can order the list. 12 Select Course Name from the first box 13 Click on the Next button. In the next window we can vary the width of the columns in the list. In the list you may see various columns, but when we select a row from the list we can only collect the value of one column, this is the key column. In our example we want the Course Name and the Hours to appear so that it will be easier for the user to select the course, but it will only collect the course code in order to place it in the Course or Students field and so the Course code is the key column. 14 Make the Course Name column wider, and make the Hours column narrower. 15 Click on the Next button. 16 Check Store that value in this field: option. 17 Select the Course field from the drop down list that appears to the right of the option. In this way when a user selects a row from the list, the course code corresponding this list will be stored in the Course field of the Students table. 18 Click on the Next button. 19 Change the name of the label if you want. 20 Click on the Finish button. You will have seen how the list box is created in almost the same way as a combo box. Now observe the result. 21 Click on the 22 Assign the course codes seen below to the students now using the list box. If the list box is too small, return to the Design view and make the list box Higher.
23 Close the form saving changes.
We have two forms, one created in Standard style and the other in Industrial style. This is not very recommendable in an application as the screens should be homogeneous, and so we will leave both styles as Industrial. 1 Position yourself in the design view of the Students Columnar form if you are not already there. 2 Click on the top left corner of the design area to select the form. 3 Click on the Autoformat
4 Select the Industrial style from the list. 5 Click on the OK button. This is how easy it is to change the style of a form. 6 Close the form saving changes. |
| |
|
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.
|