|
Form/Report Design and the Location of Controls |
|
Introduction to the Location of a Control
The Left Location of a Control
When you add a control to a form or report, it takes a position on its host. The distance from the left border of the form or report to the left border of the control is its left property.
To let you specify or change the left location of a control, while the form or report is in Design View, in the Property Sheet of the control, in the Format or the All tab, click Left and type the desired value.
Practical Learning: Setting the Left Location of a Control
- Start Microsoft Access
- In the list of files, click
StatesStatistics1 from the previous lesson
- In the Navigation Pane, right-click the States form and click Design View
- Double-click the button at the intersection of the rulers
- On the form, click State
- Press and hold Shift
- Click the left Abbreviation (the label)
- Click the other labels: StateName and Capital
- Rekease Shift
- Right-click on the selected labels and click Properties
- In the Property Sheet, click Format
- Click Left and type 0.25
- On the form, click the right Abbreviation (the text box)
- Press and hold Shift
- Click the other text boxes: StateName and Capital
- Rekease Shift
- In the Format tab of the Ribbon, click Left and type 1.50
The Top Location of a Control
The distance between the top border of a form or report and the top
border of a control is known as its top location. To let you specify this value, the
Property Sheet of the control is equipped with the Top field in the Format or the
All tabs.
Practical
Learning: Setting the Top Location of a Control
- On the form, click State.
If you don't see it,
in the combo box in the top portion of the Property Sheet, select the labels
one after the other (start with Label0) until the Caption in the Property
Sheet displays State
- In the Property Sheet, click Top and type 0.25
- On the form, select both Abbreviation(s) (the label and the text box)
- In the Property Sheet, click Top and type 0.5417
- On the form, select both StateName(s)
- In the Property Sheet, click Top and type 0.8326
- On the form, select both Capital(s)
- In the Property Sheet, click Top and type 1.125
- Save the form
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. 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 along the grid lines, on the Ribbon, click Arrange. In
the Sizing & Ordering section, click the Size/Space button. Make sure Snap to Grid
is highlighted; otherwise click it to select it. Click one of the borders of
the control and drag
left, right, up or down. When you get to the desired location, release the
mouse
- To move a control without following the grid line, on the Ribbon, click
Arrange. In the Sizing & Ordering section, click the Size/Space button and click Snap to Grid to
unset it
.
Click one of the borders of the control and drag the control left, right, up
or down. When you get to the desired location, release the mouse
To move a control or a group of controls with even more
precision, in the Property Sheet, you can change either or both the Left
and the Top values.
Moving Controls Horizontally
Introduction
Instead of moving the control(s) randomly or vertically, you
can move it(them) horizontally only:
- If you want to move one control horizontally one unit of grid
lines at a time, click the control and press the right or left arrow keys a
few times until you get the distance you want
- If you want to move a group of controls horizontally one unit of grid
lines at a time, select the controls and press the right or the left arrow
keys a few times until you get the distance you want
- If you want to move one control horizontally one unit of the grid lines at a time, first deselect the controls (make sure no control is
selected), press and hold Shift, then click the control and immediately drag the
mouse left or right. When you get to the desired location, release the mouse
and release Shift
- If you want to move many controls horizontally one unit of grid lines at a time, first deselect the controls (make sure no control is
selected), press and hold Shift, click each control except the last of the
desired group. Click the last control and immediately drag the
mouse left or right. When you get to the desired location, release the mouse
and release Shift
- If you want to move one control only horizontally without following the
grid lines, first deselect the control(s) (make sure no control is
selected), press and hold Ctrl + Shift. Click and immediately drag the mouse
left or right. When you get to the desired location, release the mouse, the
Shift and the Ctrl keys
- If you want to move many controls only horizontally without following the
grid lines, first deselect the control(s) (make sure no control is
selected). Press and hold Ctrl + Shift. Click each control except the last
to select them. When you get to the last control of the desired group, click
and immediately drag left or right. When you get to the desired location,
release the mouse, the Shift and the Ctrl keys
You can also move the controls horizontally using the Property Sheet:
- To move one control, change the value of its Left field
- To move many controls, first select them. Then, in the Property Sheet,
change the value of the Left field
Aligning Controls Horizontally
Imagine you want to position some controls of a form or
report to the left. You can start by positioning one of the labels to the desired left distance:
After doing this, the alignment of such a control 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:
- On the Ribbon, click Arrange. In the Size & Ordering section of the Arrange group of the Ribbon, click
Align and click
the Align Left button
- Right-click one of the controls in the selection,
position the mouse on Align, and click Left
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
- On the Ribbon, click File and click Open
- In the list of files, click Cruise1
- In the Navigation Pane, double-click Customers1 to open its form
- On the Ribbon, click Home
- After viewing the form, to switch it to Design View, in the Views section of the Ribbon, click the arrow under View and click Design View
- The Customers1 form should be displaying in the Design View.
On the form, click Account #
- Press and hold Shift
- On the form, click First Name
- Click Emergency Name
- Click Emergency #
- Release Shift. This allows you to select only the labels
- On the Ribbon, click Arrange
- In the Sizing & Ordering section, click Align, then click Left
- On the form, click AccountNumbe
- Press and hold Shift
- On the form, click FirstName
- Click EmergencyNam
- Click EmergencyNum
- Release Shift. This allows you to select only the text boxes
- Right-click one of the selected controls, position the mouse on Align, and click Left
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:
- If you want to move one control vertically one unit of grid
lines at a time, click the control and press the down or the up arrow keys a
few times until you get the distance you want
- If you want to move a group of controls vertically one unit of grid
lines at a time, select the controls and press the down or the up arrow keys
a few times until you get the distance you want
- If you want to move one control vertically one unit of grid
lines at a time, first deselect the controls (make sure no control is
selected), press and hold Shift, then click the control and immediately drag the
mouse up or down. When you get to the desired location, release the mouse
and release Shift
- If you want to move many controls vertically one unit of grid
lines at a time, first deselect the controls (make sure no control is
selected), press and hold Shift, click each control except the last (for
example if you want to move four controls vertically, press and hold Shift,
then click the first three). When you get to the last control of the group
(for example the 4th), click it and immediately drag (don't release after
clicking) the
mouse up or down. When you get to the desired location, release the mouse
and release Shift
- If you want to move one control vertically without following the grid lines, first deselect the control(s) (make sure no control is
selected). Press and hold Ctrl + Shift. Click and immediately drag
the control up or down. When you get to the desired location, release the
mouse and Ctrl
- If you want to move many controls vertically without following the grid lines, first deselect the control(s) (make sure no control is
selected). Press and hold Ctrl + Shift. Click each control except the last
to select them. When you get to the last control of the desired group, click
and immediately drag up or down. When you get to the desired location,
release the mouse, the Shift and the Ctrl keys
You can also move the controls vertically using the Property Sheet:
- To move one control, change the value of its Top field
- To move many controls, first select them. Then, in the Property Sheet,
change the value of the Top field
Aligning Controls Vertically
To assist you with aligning the controls on a form or a
report, the Ribbon provides various buttons in the Sizing & Ordering section of
the Arrange tab. 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. To align the controls:
- In the Sizing & Ordering section of
the Arrange group of the Ribbon, click Align and click To Top button
- Right-click one of the selected controls, position the mouse on
Align, and click Top.
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
- The Customers1 table should be displaying in the Design View.
On the form, click First Name
- Press and hold Shift
- On the form, click FirstName
- Click Last Name
- Click LastName
- Release Shift
- On the Ribbon, click Arrange if necessary.
In the Sizing & Ordering section, click Align, then click Top
- On the form, click AccountNumbe
- Press and hold Shift
- Click LastName
- Release Shift. This allows you to select only the text boxes
- Right-click one of the selected controls, position the mouse on Align, and click Right
- On the form, click Account #
- Press and hold Shift
- Click Last Name
- Release Shift
- On the Ribbon, click Arrange if necessary.
In the Sizing & Ordering section, click Align and click Right
- Click an unoccupied area of the form to dismiss the selection
- On the form, click Account #
- Press and hold Shift
- Click AccountNumbe
- Click Emergency #
- Click EmergencyNum
- Release Shift
- Right-click one of the selected controls, position the mouse on Align, and click Bottom
|