Home

Design Maintenance on Forms & Reports

Spacing the Windows Controls

Introduction

When moving and aligning the controls on a form or report, one of the concerns you may have is that the vertical distance among the controls from one range to the next or from one range to the previous range is not logically sound.

Of course, you can move the controls to adjust this. Microsoft Access provides a set of tools you can use to create a better spacing between the ranges of controls. You can first select the controls that have been vertically aligned already. Then, on the Ribbon, click Arrange. In the Sizing & Ordering section, click Size/Space and use the options in the Spacing section

The Spacing section of the Ribbon

Equally Spacing the Ranges of Controls Vertically

To apply the same distance between the most top control or range of controls and the most bottom control or range of controls, on the Ribbon, click Size/Space and click Equal Vertical. In this case, Microsoft would count the number of controls or ranges of controls between them, divide the distance by the number, and apply the result as the vertical distance among the horizontally aligned controls.

Practical Learning: Equally Spacing the Ranges of Controls

  1. Start Microsoft Access
  2. From the list of files, click Cruise1 (from the previous lessons)
  3. In the Navigation Pane, double-click Customers1 if you followed the previous lesson (otherwise, open Customers2)
  4. After viewing the form, to switch it to Design View, right-click anywhere in the body of the form and click Design View
  5. Click anywhere in the body of the form.
    To select all controls on the form, press Ctrl + A
  6. On the Ribbon, click Arrange
  7. In the Sizing & Ordering section, click Size/Space
  8. Click Equal Vertical

    Selecting Some Fields

Increasing Vertical Spacing of Ranges of Controls

To get the highest distance between two horizontal ranges, on the Ribbon, click Size/Space and click Increase Vertical. In this case, Microsoft Access would get the lowest distance between two horizontal ranges. Microsoft Access would then calculate the average of these measures. Then, each set of the horizontal range of controls would be moved down by that value

Decreasing Vertical Spacing of Ranges of Controls

In the Sizing & Ordering section of the Ribbon, if you click Size/Space and click Decrease Vertical, Microsoft Access would get the highest distance between two horizontal ranges. It would also get the lowest distance between two horizontal ranges. Microsoft Access would then calculate the average of these measures. Each set of the horizontal range of controls would be moved up by that value

Practical Learning: Decreasing Vertical Spacing of Controls

  1. All controls on the form should still be selected. Otherwise, to select all controls on the form, press Ctrl + A.
    On the Ribbon, click Arrange if necessary.
    In the Sizing & Ordering section of Ribbon, click Size/Space
  2. Click Decrease Vertical

    Selecting Some Fields

  3. Keep clicking Size/Space -> Decrease Vertical until the ranges of controls are separated by 2 dotted lines

    Selecting Some Fields

  4. On the Ribbon, click File and click Open
  5. In the list of files, click Ceil Inn1 from Lessons 7
  6. When asked whether you want to save, click Yes
  7. On the Ribbon, click Create
  8. In the Forms section, click Form Design
  9. Double-click the button at the intersection of the rulers Intersection of Rulers
  10. In the Property Sheet, click Data and click Record Source
  11. Type e and press Tab (make sure Employees has been selected)
  12. On the Ribbon, click Design.
    In the Tools section, click Add Existing Fields
  13. From the Field List, drag EmployeeNumber and drop it somewhere in the top section of the form (no need for precision)

    Adding a Field to a Form

  14. From the Field List, drag FirstName and drop it somewhere below EmployeeNumber on the form (there is no need to be precise but drop FirstName somewhere below EmployeeNumber)
  15. From the Field List, drag LastName and drop it somewhere below FirstName on the form
  16. From the Field List, drag Title and drop it somewhere below LastName on the form. Here is an example (but please don't change the design of your form to look like the following):

    Adding Some Fields to a Form

  17. Close the form
  18. When asked whether you want to save it, click Yes
  19. Set the Form Name to Employees and click OK
  20. On the Ribbon, click Create
  21. In the Forms section, click Form Design
  22. Double-click the button at the intersection of the rulers Intersection of Rulers
  23. In the Property Sheet, click Data, then click Record Source, type c and press Enter (make sure Customers has been selected)
  24. On the Ribbon, click Design.
    In the Tools section, click Add Existing Fields Field List
  25. From the Field List, drag AccountNumber and drop it somewhere in the top-left section of the form (no need for precision)
  26. From the Field List, drag FirstName and drop it somewhere below AccountNumber in the middle-left section of the form (no real need for precision)
  27. From the Field List, drag LastName and drop it somewhere below FirstName in the bottom-left form (no need for precision):
    Here is an example (but please don't change the design of your form to look like this)

    Adding Some Fields to a Form

  28. From the Field List, drag PhoneNumber and drop it somewhere in the top-right section of the form on the right side of AccountNumber (no need for precision)
  29. From the Field List, drag EmergencyName and drop it somewhere below PhoneNumber on the form (in the middle-right section) (no need for precision)
  30. From the Field List, drag EmergencyPhone and drop it somewhere on the bottom-right side of the form below EmergencyName (no need for precision):
    Here is an example (but don't change the design of your form)

    Adding Some Fields to a Form

  31. Close the form
  32. When asked whether you want to save the changes, click Yes
  33. Set the Form Name to Customers and press Enter
  34. On the Ribbon, click Create
  35. In the Forms section, click Form Design
  36. Double-click the button at the intersection of the rulers Intersection of Rulers
  37. In the Property Sheet, click Data, then click Record Source, type o and press Enter (make sure Occupancies has been selected)
  38. On the Ribbon, click Design if necessary.
    In the Tools section, click Add Existing Fields Field List
  39. In the Field List, click OccupancyNumber
  40. Press and hold Shift
  41. Click PhoneCharge
  42. Release Shift
  43. Drag the selection and drop it somewhere on the form (no need for precision)
  44. On the Ribbon, click File and click Open
  45. In the list of files, click Road System1 (from Lesson 8)
  46. When asked whether you want to save the changes, click Yes
  47. Set the Form Name to OccupancySummary and press Enter

Spacing a Stack of Controls Horizontally

Microsoft Access provides another set of tools you can use to create a better spacing among the controls of the same range. To start, you can select the controls. After selecting the controls, on the Ribbon, click Arrange. In the Size & Ordering section, click Size/Space and use the Horizontal options in the Spacing section: Equal Horizontal: The controls would be moved to be adjacent to each other

Imagine the controls were not positioned on top of each other, for example, suppose you want to position the controls of our bottom range. Once again, first select them. Then click the Equal horizontal button. In this case, Microsoft Access would get the various distances among the controls, and the distance between the middle control and the right one. Then, Microsoft Access would calculate the average of these measures, and would apply it as the new distance among the controls.

If you want to apply a better spacing among the controls of the same range. First select the controls of the same range. On the Ribbon, click Arrange. In the Sizing & Ordering section, click Size/Space. The options you can use are: Increase Horizontal and Decrease Horizontal.

Stacking or Juxtaposing the Controls

Stacking Controls Vertically

One of the ways you can align the controls is to stack them; that is, to position controls above each other. Besides the manual techniques we saw already, to stack a group of controls, first select them. Then, on the Ribbon, click Arrange. In the Table section, click Stacked Stacked.

Practical Learning: Stacking Some Controls

  1. In the Navigation Pane, double-click Roads (or Roads1 if you are using our Road System1 database)
  2.  After viewing the form, right-click its body and click Design View
  3. Click anywhere on the form to make sure it has focus.
    To select all controls on the form, press Ctrl + A

    Selecting Some Fields

  4. On the Ribbon, click Arrange
  5. In the Table section, click Stacked

    Selecting Some Fields

  6. Close the form
  7. When asked whether you want to save it, click Yes
  8. On the Ribbon, click File and click Open
  9. In the list of files, click Ceil Inn1 ussed earlier
  10. In the Navigation Pane, right-click the Employees form and click Design View
  11. In the form, click either Employee # or EmployeeNumber (click any of them)
  12. Press and hold Shift
  13. Click First Name or FitstName (any of them)
  14. Click Last Name or LastName (any of them)
  15. Release Shift

    Selecting Some Fields

  16. On the Ribbon, click Arrange
  17. In the Table section, click Stacked

    Selecting Some Fields

  18. Close the form
  19. When asked whether you want to save, click Yes
  20. In the Navigation Pane, right-click the Customers form and click Design View
  21. In the form, click Account # or AccountNumber (click any of them)
  22. Press and hold Shift
  23. Click First Name or FitstName (any of them)
  24. Click Last Name or LastName (any of them)
  25. Release Shift

    Selecting Some Fields

  26. On the Ribbon, click Arrange
  27. In the Table section, click Stacked

    Selecting Some Fields

  28. In the form, click either Phone # or PhoneNumber
  29. Press and hold Shift
  30. Click Emergency Name or  EmergencyName
  31. Click Emergency # or EmergencyPhone
  32. Release Shift

    Selecting Some Fields

  33. On the Ribbon, click Arrange if necessary.
    In the Table section, click Stacked

    Selecting Some Fields

  34. Close the form
  35. When asked whether you want to save it, click Yes
 
 
 

Managing Stacked Controls

Selecting and Managing Controls

Before taking any action on a group of stacked controls, you must first select them. You have three options:

  • To select all objects in the group, click one of them. There would appear a gray square with a cross inside

    Selecting Controls

    Click it
  • To select controls on the same column, click one of them. On the Ribbon, click Arrange. In the Rows & Column section, click Select Column
  • To select controls on the same row, click one of them. On the Ribbon, click Arrange. In the Rows & Column section, click Select Row
  • To select all objects in the group, on the Ribbon, click Arrange. In the Rows & Column section:
    • Click Select Layout
    • Click Select Column and click Select Row

Practical Learning: Moving Stacked Controls

  1. In the Navigation Pane, right-click the Employees form and click Design View
  2. On the form, click either Employee # or EmployeeNumber
  3. Click the square button that appears and hold your mouse down

    Selecting Some Fields

  4. Drag the selected controls to the top-left so that the group aligns with two measures from left and the top sides of the rulers

    Selecting Some Fields

    Selecting Some Fields

  5. Click an unoccupied area of the form to dismiss the selection
  6. On the form, click Last Name
  7. Press and hold Shift
  8. Click the left Title
  9. Release Shift
  10. On the Ribbon, click Arrange if necessary.
    In the Sizing & Ordering section, click Align and click Left
  11. On the form, click LastName
  12. Press and hold Shift
  13. Click the right Title
  14. Release Shift
  15. Right-click one of the selected items, position the mouse on Align and click Left
  16. On the form, click Last Name
  17. Press and hold Shift
  18. Click the left Title
  19. Right-click one of the selected items, position the mouse on Size, and click to Widest
  20. On the form, click the right Title to select the text box
  21. Position the mouse on the right border and drag right to measure 5

    Selecting Some Fields

  22. Click and drag the wide Title up to move it under the other controls

    Selecting Some Fields

  23. Resize the Detail section to be just enough for the controls on the form

    Selecting Some Fields

  24. Close the form
  25. When asked whether you want to save it, click Yes
  26. In the Navigation Pane, right-click the Customers form and click Design View
  27. On the form, click AccountNumber
  28. Click its square button and hold your mouse down
  29. Drag the selected controls to the top-left so that the group aligns with two measures from left and the top sides of the rulers

    Moving Some Fields

  30. Still on the form, click any of the control in the right section of the form (such as Phone #, PhoneNumber, etc)
  31. Click the square button and hold your mouse down

    Selecting Some Fields

  32. Drag the selected controls to 2 ruler measures from the right side of AccountNumbmer

    Moving Some Fields

  33. Resize the Detail section to be just enough for the controls on the form

    Selecting Some Fields

  34. Close the form
  35. When asked whether you want to save it, click Yes

Managing the Layout of Stacked Controls

There are many actions you can take on the controls that belong to a stacked or tabular group of control. As you may know already, the controls are considered as a group. To separate them and treat each individually, select the group. In the Table section of the Arrange tab of the Ribbon, click the Remove Layout button Remove Layout.

To delete all controls from the group, after accessing the group:

  • Press Delete
  • On the Ribbon, click Home. In the Records section, click the arrow of the Delete button and click Delete

Practical Learning: Removing a Stack

  1. In the Navigation Pane, right-click the Employees form and click Design View
  2. On the form, click Employee # and click the cross icon on its left

    Stacked Controls

  3. On the Ribbon, click Arrange
  4. In the Table section, click the Remove Layout button Remove Layout

    Stacked Controls

  5. Close the form
  6. When asked whether you want to save it, click Yes

Adding a Stacked Column

Normally, when you select some controls and click the Stacked button, Microsoft Access uses the number of vertical ranges to decide how many columns to create. If those are not enough, you can add new empty columns. To do this, select the group. On the Ribbon, click Arrange. In the Rows & Columns section:

  • To add a column to the left of the existing columns, click Insert Left Insert Left
  • To add a column to the right of the existing columns, click Insert Right Insert Right

Adding a Row

When you create a group of controls using the Tabular option, Microsoft Access uses the number of columns to decide how many rows to create. If you want, you can add new empty rows. To do this, select the group. On the Ribbon, click Arrange. In the Rows & Columns section:

  •  To add a range above the left row, click Insert Left Insert Above
  • To add a column to the right of the existing columns, click Insert Left Insert Below

Designing a Group of Controls

Creating a Group of Controls

If you have a group of controls to design and 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 controls. Then, on the Ribbon, click Arrange. In the Sizing & Ordering section, click the Size/Space button and click Group Group:

Grouping Items

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 selected again to indicate that the selected controls are part of a group.

Dismissing a Group of Controls

When you don't need a group anymore, to dismiss it, on the Ribbon, click Arrange. In the Sizing & Ordering section, click the Size/Space button and click Ungroup .

Control Maintenance

Copying a Control

If you had applied some design on a control and you want to replicate that design, you can copy the control. This is mostly a simple operation of copy n' paste. You can copy a control on a form (or report) and paste it on the same form (or report) or you can paste it in another form (or report). When you copy and paste a control, there are some characteristics it would retain and some others it would loose. Normally, it would keep its aesthetic characteristics and its size but it will loose some others (such as its location and its programmatic characteristics such as its name.

To copy a control, first select it and then press Ctrl + C. You can also right-click a control and click Copy. To copy a group of controls, select them and press Ctrl + C. You can also select the controls, right-click one of the selected controls, and click Copy.

To paste a copied control or a copied group of controls from the clipboard, click the destination and press Ctrl + V. You can also right-click the destination and click Paste.

Deleting a Control

To delete a control from a form or a report, click it and press Delete. To delete a group of controls, select them and press Delete.

Tab Ordering the Controls

When performing data entry on a form, the user can press Tab to move from one control to another. If there is no control on the right side, the caret should move to the control under the one previously used. If the caret or focus is in the last bottom control on the form and the user press Tab, the caret should move to the next record, unless the form is configured to display only one record. This follows the arranged sequence of the controls on the form. For this reason, the controls on a form should be aligned in the order of a logical sequence.

When you add a control to a form that already has other controls, it is sequentially positioned at the end of the existing controls. The sequence of controls navigation is set using the Tab Order dialog box. The Tab Order dialog box is available when the form is opened in Design View. To display it, while the form is in Design View:

  • Right-click the form and click Tab Order...
  • On the Ribbon, click Design. In the Tools section, click the Tab Order button Tab Order

This would open the Tab Order dialog box:

Tab Order

The simplest and quickest way to rearrange the order of items is to click the Auto Order button. Sometimes, you will not like the arrangement made by the Tab Order dialog box. To rearrange items manually, you can move a row or a group of rows.

Practical Learning: Sequentially Ordering Controls

  1. On the Ribbon, click File and click Open
  2. In the list of files, click Cruise1 used earlier (or open the Cruise1 database)
  3. In the Nagivation Pane, double-click the Carriers form to open it
  4. Press Tab four times and notice what controls are selected after others
  5. Right-click the body of the form and click in Design View
  6. On the Ribbon, click Design if necessary.
    In th Tools section, click the Tab Order button Tab Order
  7. Position mouse on the left button of ShipName until the mouse turns into a right pointing arrow

    Tab Order

  8. Click to select the row, and release the mouse
  9. Click and hold your mouse on the same row header
  10. Drag up and notice the horizontal line that guides you
  11. Release the mouse when it is positioned just under ShipCode
  12. Complete the orders as follows:

    Tab Order

  13. Click OK to acknowledge the order
  14. To save the form, press Ctrl + S
  15. To close the form, press Ctrl + F4

Accessories for Record Display on a Form

The Scroll Bars of a Form

As mentioned in Lesson 5, when designing a form, you can specify its width. When the form displays in Form View, if the user shrinks or narrows it so much that the current width is not enough to display the controls, the form would be equipped with one or more scroll bars:

Scroll Bars

To let you control the display of scroll bars, the Property Sheet is equipped with the Scroll Bars property.

Scroll Bars

The available values are:

  • Vertical Only: If the user narrows the form so that some controls from the right side of the form become hidden, the form must display a vertical scroll bar:

    The Vertical Scroll Bar

  • Horizontal Only: If the user shrinks the form so that some controls in the bottom side of the form become hidden, the form must display a horizontal scroll bar
  • Both: If the user either or both narrows or shrinks the form so that some controls become hidden, the form must display either or both a horizontal and/or a vertical scroll bar
  • Neither: The form must hide both scroll bars at all times even if some controls are hidden from the form

The Navigation Buttons

The lower left section of a form displays the same navigation buttons as the table: the First Record button , the Previous Record button , the Current Record text box , the Next Record button , the Last Record button , and the New (Blank) Record button

Unlike the table, the form does not require the navigation buttons. To let you display or hide the navigation buttons, the Property Sheet of the form is equipped with the Navigation Buttons property.

The Navigation Caption

The left side of the status bar of a form displays the Record: label. This is controlled by the Navigation Caption property. Here is an example:

Navigation Caption

The Record Selectors

A form is equipped with a special area, called the Record Selector, that allows you to select a record. The Record Selector is on the left side immediate to the left section of a record on the form. Its size depends on the type of record. For a regular form (Single Form), the record selector is the long vertical box on the left of all records:

Record Selector

If you do not want a form to display the record selector(s), in its Design View, set its Record Selectors property to No.

Practical Learning: Hiding the Record Selector

  1. The Cruise1 database should still be opened.
    In the Navigation Pane, right-click the CruiseShips form and click Design View
  2. In the Property Sheet, click the Format tab and double-click Record Selectors to set its value to No
  3. To preview the form, on the right side of the status bar, click the Form View button
  4. Close the form
  5. When asked whether you want to save, click Yes
  6. Close Microsoft Access
 
 
   
 

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