Home

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

  1. Start Microsoft Access
  2. In the list of files, click StatesStatistics1 from the previous lesson
  3. In the Navigation Pane, right-click the States form and click Design View
  4. Double-click the button at the intersection of the rulers Intersection of Rulers
  5. On the form, click State
  6. Press and hold Shift
  7. Click the left Abbreviation (the label)
  8. Click the other labels: StateName and Capital
  9. Rekease Shift
  10. Right-click on the selected labels and click Properties
  11. In the Property Sheet, click Format
  12. Click Left and type 0.25
  13. On the form, click the right Abbreviation (the text box)
  14. Press and hold Shift
  15. Click the other text boxes: StateName and Capital
  16. Rekease Shift
  17. 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

  1. 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
  2. In the Property Sheet, click Top and type 0.25
  3. On the form, select both Abbreviation(s) (the label and the text box)
  4. In the Property Sheet, click Top and type 0.5417
  5. On the form, select both StateName(s)
  6. In the Property Sheet, click Top and type 0.8326
  7. On the form, select both Capital(s)
  8. In the Property Sheet, click Top and type 1.125

    The Top Locations of Windows Controls

  9. 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 Snap to Grid. 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:

Form Design: Positioning a Control Whose Alignment Would be Used as a Reference

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:

Controls Alignment

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

    Left

  • 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

  1. On the Ribbon, click File and click Open
  2. In the list of files, click Cruise1
  3. In the Navigation Pane, double-click Customers1 to open its form

    Adding Fields

  4. On the Ribbon, click Home
  5. 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
  6. The Customers1 form should be displaying in the Design View.
    On the form, click Account #
  7. Press and hold Shift
  8. On the form, click First Name
  9. Click Emergency Name
  10. Click Emergency #
  11. Release Shift. This allows you to select only the labels

    Selecting Fields

  12. On the Ribbon, click Arrange
  13. In the Sizing & Ordering section, click Align, then click Left

    Adding Fields to a Form

  14. On the form, click AccountNumbe
  15. Press and hold Shift
  16. On the form, click FirstName
  17. Click EmergencyNam
  18. Click EmergencyNum
  19. Release Shift. This allows you to select only the text boxes

    Adding a Field

  20. Right-click one of the selected controls, position the mouse on Align, and click Left

    Adding Fields

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:

Moving a Control

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

  1. The Customers1 table should be displaying in the Design View.
    On the form, click First Name
  2. Press and hold Shift
  3. On the form, click FirstName
  4. Click Last Name
  5. Click LastName
  6. Release Shift

    Selecting Fields

  7. On the Ribbon, click Arrange if necessary.
    In the Sizing & Ordering section, click Align, then click Top

    Aligning Fields

  8. On the form, click AccountNumbe
  9. Press and hold Shift
  10. Click LastName
  11. Release Shift. This allows you to select only the text boxes

    Adding a Field

  12. Right-click one of the selected controls, position the mouse on Align, and click Right

    Aligning Fields

  13. On the form, click Account #
  14. Press and hold Shift
  15. Click Last Name
  16. Release Shift

    Adding a Field

  17. On the Ribbon, click Arrange if necessary.
    In the Sizing & Ordering section, click Align and click Right

    Adding Fields

  18. Click an unoccupied area of the form to dismiss the selection
  19. On the form, click Account #
  20. Press and hold Shift
  21. Click AccountNumbe
  22. Click Emergency #
  23. Click EmergencyNum
  24. Release Shift

    Selecting Fields

  25. Right-click one of the selected controls, position the mouse on Align, and click Bottom

    Aligning Fields

 
 
 

The Size of a Control

Introduction

The size of a control is both:

  • The distance from its left to its right borders: its width
  • The distance of its top to its bottom borders: its height

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 cursors can be used to resize one control, they can also be applied to a group of controls. Based on this:

  • To resize a control along the grid lines, select it first. Position the mouse on one of the handles to seize the cursor of your choice. Click and drag in the desired and appropriate direction
  • To resize a control without following the grid lines, select it first. Press and hold Ctrl. Position the mouse on one of the handles to seize the cursor of your choice. Click and drag in the desired and appropriate direction

Practical Learning: Resizing a Control

  1. The Customers1 table should be displaying in the Design View.
    On the form, click EmergencyNam
  2. Position the mouse on the right border to see a horizontal arrow
  3. Click and drag right until the right border aligns with the vertical line on 5

    Resizing a Control

    Resizing a Control

  4. Click the button at the intersection of the rulers to deselect anything

Resizing Various Controls

Instead of one, you can resize a group of controls at the same time:

  • To resize more than one control along the grid lines, select them. Position the mouse on one of the handles of the selected controls to get the desired cursor. Click and drag appropriately. all of the selected controls would be resized
  • To resize more than one control without following the grid lines, select them first. Press and hold Ctrl. Position the mouse on one of the handles of the selected controls to get the desired cursor. Click and drag appropriately. all of the selected controls would be resized

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.

To resize the controls:

  • On the Ribbon, click Arrange. Click the Size/Space button and use the options in the Size section:

Size

  • Click one of the selected controls, position the mouse on Size, and select one of the options:
Ribbon Menu Name Shortcut Menu Description
Size to Fit Size to Fit To Fit The controls will be resized based on the contents of their value
Size to Grid Size to Grid To Grid The controls will be resized so their borders fit with the grid lines
Size to Tallest 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 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 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 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 Some Controls

  1. The Customers1 table should be displaying in the Design View.
    Position the mouse in the horizontal (top) ruler of the form above First Name
  2. Click (this should select First Name, Emergency Name, and Emergency #)

    Adding a Field

  3. On the Ribbon, click Arrange if necessary.
    Click Size/Space and click To Widest

    Aligning Fields

The Size of a Control

You can also resize a control or a group of controls using the Property Sheet. In the Property Sheet, 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 Property Sheet, change either or both the values of the Width and/or the Height fields.

Practical Learning: Setting the Size of a Control

  1. On the Ribbon, click File and click Open
  2. In the list of files, click StatesStatistics1 used earlier
  3. In the Navigation Pane, right-click the States form and click Design View
  4. Double-click the button at the intersection of the rulers Intersection of Rulers
  5. On the form, click State
  6. In the Format tab of the Property Sheet, click Width
  7. Type 3
  8. On the form, click the left Abbreviation (the label)
  9. Press and hold Shift
  10. Click the left StateName
  11. Click the left Capital
  12. Release Shift
  13. In the Width field of the Property Sheet, type 1.2076
  14. On the form, click the right Abbreviation (the text box)
  15. Press and hold Shift
  16. Click the right StateName
  17. Click the right Capital
  18. Release Shift
  19. In the Width field of the Property Sheet, type 1.75

    The Widths of Windows Controls

  20. Close Microsoft Access
  21. When asked whether you want to save, click Yes
 
 
   
 

Previous Copyright © 2007-2016, FunctionX, Inc. Next