Details on Controls Design |
|
Control Selection |
Selecting One Control |
After adding a control to a form or report in Design View, to manipulate it, you can first select the control. To select a control: |
A control that is selected displays 8 handles around its body with the top-left handle thicker than the others:
When a control is selected on the form or report, the Properties window shows only its characteristics and you can change only the characteristics of the selected control:
Notice that the combo box in the Properties window displays the name of the selected control.
Practical Learning: Startinge the Lesson
Selecting Various Controls |
To select more than one control, at random, click one, then press and hold Shift. While holding Shift, click each of the desired controls. After selecting the controls, release Shift.
To select controls aligned vertically, click inside of the horizontal ruler above the highest positioned control. Everything that would be touched by the fake line will be selected:
In the same way, you can select controls that are
horizontally aligned by clicking inside the vertical ruler.
To
select many controls in the same area on the form, click next to one of
them and draw a fake rectangle that covers each of the desired controls:
All controls touched by the fake rectangle would be selected when you release the mouse
To select all controls on the form or report, you can press Ctrl + A. You can also click inside of one of the rulers on one end and drag to the other end. After selecting the controls, you can change the common properties of the selected controls.
To remove a control from a group of selected controls, press and hold Shift, then click the undesired control of the group. You can include an object back in the group by pressing Shift and clicking the control.
To dismiss a group of selected controls, you can simply click an unoccupied area of the form or report. In some cases, you may have removed a control from the group by mistake or you may have dismissed the group by mistake while you still need it.
If you have a group of controls that you will use over and over again, you can include them in a formal group so that, even if you click an unoccupied area of the form or report, the group would have been saved and you can get it back when needed.
To create and save a group of controls, first select the group. Then, on the Ribbon, click Arrange. In the Sizing & Ordering section, click the Size/Space button and click Group :
Remember that controls you want to select do not have to be adjacent. If you click an unoccupied area of the form or report, the selection would disappear but the group would have been saved. If you click any control of the group, the controls that belong to the group would be selection again to indicate that the selected controls are part of a group. When you do not need the group anymore, to dismiss it, on the Ribbon, click Arrange. In the Sizing & Ordering section, click the Size/Space button and click Ungroup .
When many controls are selected, the Properties window shows (only) the characteristics common to those controls:
This means that you can change the common characteristic(s) that many controls share and each would receive the change.
Practical Learning: Selecting Controls
The Location of a Control on a Form or a Report
The Top and Left Properties of a Control |
When you add a control to a form or report, it takes a position on its host but it depends on the control. The location of a control is both:
In the Properties window, the distance between the top border of the form or report and the top border of the control is represented by the Top property. The distance between the left border of the form or report and the left border of the control is represented by the Left property:
Moving Controls Randomly |
After adding a control to a form or report, it assumes a position based on where you clicked but this may depend on the control. Most of the time, you will want to change the position. Moving a control consists of changing its location on the form or the report. There are various ways you can do this.
You can move a control along the grid lines or you can ignore them:
To move a control or a group of controls with even more precision, in the Properties window, you can change either or both the Left and the Top values.
Practical Learning: Moving Controls Randomly
Moving Controls Vertically |
Introduction |
When a control has been selected, as your mouse moves over it, its pointer displays a different cursor. One of these cursors can be used to move a control. This cursor is represented as a cross with four arrows:
By default, when dragging the control(s), it(they) move(s) by one unit of the grid lines on the form or report and you can move left, right, up, or down but:
You can also move the controls vertically using the Properties window:
Practical Learning: Moving Controls Vertically
Aligning Controls Vertically |
Consider the following form:
One of the obvious problems is that this layout does not follow any reasonable logic. Among the remedies to this, you can better align the controls. For example, you may want the First Name label, the top Unbound text box, the MI label and its text box to have the same distance from the top border of the form. Aligning the controls consists of using a reference to position other controls based on this reference. Fortunately, Microsoft Access provides all the necessary tools to align the controls on a form or report.
To assist you with aligning the controls on a form or a report, the Ribbon provides the Control Formatting section in the Format tab. To access it, while the form or report is in Design View, on the Ribbon, click Format. You will see the section labeled Control Alignment:
Before aligning some controls you must first decide which one would be used as a reference. This means that you can use the alignment of one control as a reference for the other controls. To do this, position that control as the others should be aligned vertically. For example, imagine that, from the above form, you want to position the First Name label, its text box, the MI label, and its text box to have the same distance from the top border of the form. You can start by positioning one of these control at the top distance you want. Here is an example:
After doing this, the alignment of such a control, in this case the top alignment of the First Name label, can be used to align the First Name text box, the MI label, and the MI text box. To align the other controls, first select them. Here is an example:
To align the controls:
Here is the result from the above selection:
In the same way, you can align other controls. You can also align controls to the bottom: first align the one that would be used as the reference, select the others, and click the Bottom button in the Control Alignment section of the Ribbon. You can also right-click one of the controls in the selection, position the mouse on Align, and click Bottom.
Practical Learning: Aligning Controls Vertically
Moving Controls Horizontally
Introduction |
Instead of moving the control(s) randomly or vertically, you can move it(them) horizontally only:
You can also move the controls horizontally using the Properties window:
Practical Learning: Moving Controls Horizontally
Aligning Controls Horizontally |
Imagine you want to position some labels of the above form to the left. You can start by positioning the First Name label to the desired left distance:
After doing this, the alignment of such a control, in this case the First Name label, can be used as a reference for the others. To align the other controls, first select them. Here is an example:
Notice that only the controls that will be aligned, in this case only some labels, have been selected. To align them:
Here is the result from the above selection:
In the same way, you can align other controls. You can also align controls to the right: first align the one that would be used as the reference, select the others, and click the Right button in the Control Alignment section of the Ribbon.
Practical Learning: Aligning Controls Horizontally
Introduction |
The size of a control is both:
When you add a control to a form or report, it assumes a certain size depending on the type of control. In some cases, you will want to change the size the a control. Resizing a control consists of changing its measures. There are various ways you can do this.
Resizing a Control |
Resizing a control consists of changing either its width, its height, or both. Before resizing a control, first select it. To resize a selected control, position the mouse on one of its borders. When the mouse moves over a selected control and reaches one of the handles, the mouse pointer displays a double-arrow cursor. The possible mouse pointers are:
Cursor | Role |
Shrinks or heightens the control | |
Resizes the control in North-East <-> South-West direction | |
Narrows or widens the control | |
Resizes the control in North-West <-> South-East direction |
Although these pointers can be used to resize one control, they can also be applied to a group of controls. Based on this:
Practical Learning: Resizing a Control
Resizing Various Controls |
Instead of one, you can also resize a group of controls at the same time:
To further assist you with resizing a control, Microsoft Access provides the Size/Space button of the Ribbon. To access it, while the form or report is in Design View, click Arrange. To resize a group of controls, first select one and set the desired size, such as the desired width. Consider the following form:
Imagine you would like the First Name text box, the Last Name text box, and the Gender combo box to have the same dimensions. First select the controls that will be resized:
To resize the controls:
Ribbon Menu | Name | Shortcut Menu | Description |
Size to Fit | To Fit | The controls will be resized based on the contents of their value | |
Size to Grid | To Grid | The controls will be resized so their borders fit with the grid lines | |
Size to Tallest | To Tallest | The heights of the selected controls will be increased to match the height of the tallest control | |
Size to Widest | To Widest | The widths of the selected controls will be increased to match the width of the widest control | |
Size to Shortest | To Shortest | The heights of the selected controls will be decreased to match the height of the shortest control | |
Size to Narrowest | To Narrowest | The widths of the selected controls will be decreased to match the width of the narrowest control |
Practical Learning: Resizing Various Controls
The Width and the Height Properties of a Control |
You can also resize a control or a group of controls using the Properties window. In the Properties window, the width of a control is represented by the Width property while the height of a control is represented by the Height field. Therefore, to resize a control with more precision, you can change either or both its Width and/or its Height properties. To resize a group of controls, first select them. In the Properties window, change either or both the values of the Width and/or the Height fields.