Unit 11. Forms (III).
To define how the information within a form will appear, and in what format it will be, we use controls. A control is nothing more than an object that shows data, performs actions, and/or is used as decoration. E.g, we can use a text box to show data, a command button to open a form or report, or a line or a rectangle to separate or group controls in order to make them more legible.
In the Toolbox we have a button for each type of control that can be added to a form.
If the Toolbox does not appear, click on the button on the toolbar.
If we want to create various controls of the same type we can block the control by double clicking on it (it will appear enclosed in a darker line), as from this moment we can create all the controls we want of this type without having to double clic every time. To unblock, all we need to do is click on the button.
There is a wizard that will help us to define the control, to activate it wizard click on button.
The Toolbox includes the following types of controls:
A Label serves to visualize a fixed text, text that we write directly into its control or Caption property.
A Text box is usually used to present data stored in a source field of the form. This type of text box is called an dependant text box because it is dependant of the data in one specific field, and if we edit data in the Form view we will be changing the data at the source. Text boxes can also be independant, e.g to represent the results of a calculation, or to accept the entry of a users data. The data in an independant text box is not stored anywhere. In the Control source property we have the name of the associated table's field (when it is dependant) or a calculation formula if we want it to present the result to us in this case the formula needs to be preceeded by a = sign.
An Option Group is used to present a limited group of alternatives. A group of options makes it easier to select a value as the user only needs then to click on the value he requires. There should only be a few options, otherwise it would be better to use a list box or a combo box instead of an option group.
When we insert a group of options the wizard will appear to help us to define the group.
The Toggle button is usually used to add a new option to an existing Option Group, it can be used to present a Yes/No field; if the field contains a Yes value the button will appear depressed.
The Option button is usually used to add a new option to an existing Option Group, it can be used to present a Yes/No field; if the field contains a Yes value the button will appear like this , if not , like this.
The Check box is usually used to add a new option to an existing Option Group, it can be used to present a Yes/No field; if the field contains a Yes value the button will appear like this , if not , like this .
The Combo box . In many cases it will be easier to select a value from a list than to remember it in order to type it. A list of possibilities also helps to assure that the value introduced is correct. If we do not have sufficient space to show the list at all times the combo box is used as it shows only one value (that which is associated with the control), and if we want to see the list we can drop it down with the arrow to the right. When we add a combo box to the design area the wizard will open to help us to define the control.
The List box . The difference between the combo box and the list box is the list appears visible at all times in a list box. Like a combo box, a list box can also contain one or more columns, that can appear with or without headers. When we add a list box to the design area the wizard will open to help us to define the control.
The Command permits the execution of an action with simply a click, e.g to open another form, to delete a record, to run a macro, etc... On clicking the button it does not only execute the corresponding action, but the button also appears depressed and then released. It also has an associated wizard that permits us to create buttons to perform more than 30 different predefined actions.
The Image is used to insert images into the form, this image does not vary on changing the record.
An Unbound object frame is used to insert controls, e.g a sound, a Word document, a graphic, etc... These controls will not vary when we change the record.
A Bound object frame is used to insert an image or other object that will change from one record to another.
A Page break does not have any effect on the Form view, but rather on the preview and at the moment of printing.
The Control tab is used when we want to present many fields for each source record but they do not fit on one screen and we want to organize them in various tabs.
We can also add a Subform . A subform is a form that is inserted into another. The primary form is called the principal form, and the form within this is called the subform. A form/subform combination is often referred to as a hierarchial form, a principal/detail form, or a principal/secondary form. Subforms are very effective when we want to show the data of a table or query in relation to another. E.g, we can create a form to show the data in the Courses table with a subform to show the students recorded in this course.
The principal form and the subform of this type are linked, so that the subform will only present those records that are related with the actual record of the principal form (that the subform will only show those students that are recordred in the active course).
A Line is used to add a line to the form.
A Rectangle is used to add a rectangle to the form.
Finally, we can add more complex controls with the button.
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.