Home

The Appearance of Windows Controls

Fundamental Design Characteristics of a Windows Control

The Name of a Control on a Form or Report

If you add a text box Text Box or another control from the Controls section of the Ribbon to the form or report, the control would receive a default name. If you drag an object from the Field List to a form or report, the control would use the name of the field set in the table. In both cases, you can change the name of the control.

To change the name of a control on a form or a report, first switch to Design View and access the Property Sheet for the control. In the Property Sheet, click the Other or the All tab:

Practical Learning: Naming Objects

  1. Start Microsoft Access
  2. Click Blank Desktop Database
  3. Set the file name to Chemistry1
  4. Close the default table without saving it
  5. On the Ribbon, click Create
  6. In the Forms section, click Form Design
  7.  In the Controls section, right-click the Text Box Text Box and click Drop Multiple Controls
  8. Click somewhere in the upper section of the form (no need for precision)
  9. On the form, click below the first text box
  10. In the Controls section of the Ribbon, click the Select button Select
  11. On the form, double-click the first Unbound text box (on the right side of Text0)
  12. In the Property Sheet, click the Other tab and click Name
  13. Type txtElementNumber
  14. On the form, click the other Unbound text box (on the right side of Text2)
  15. In the Name field of the Property Sheet, type txtSymbol
  16. To save and close the form, click its Close button Close
  17. When asked whether you want to save, click Yes
  18. Set the name to Elements and click OK

Record and Control Source

If you create a form or a report based on a table, its Windows controls would be linked to the original table where they would get their data from. Otherwise, to link a control to a field of a table, first switch the form or report to Design View and make sure you had set the form or report's Record Source property to the table that holds the field. Double-click the control to access its Property Sheet. In the Property Sheet, click either the Data or the All tab. Click the Control Source field and select an item from its combo box.

Practical Learning: Setting Control Sources of Objects

  1. On the Ribbon, click Create
  2. In the Tables section, click Table Design
  3. Under Field Name, type AtomicNumber, press Tab, and type n (for Number)
  4. On the Ribbon, click the Primary Key button Primary Key
  5. Click the cell below AtomicNumber and type Symbol
  6. In the left section of the title bar of Microsoft Access, click the Save button Save
  7. Set the name to Elements and press Enter
  8. Close the Elements table
  9. In the Navigation Pane, right-click the Elements form and click Design View
  10. If the Property Sheet is not displaying, double-click the button at the intersection of the rulers Intersection of Rulers.
    In the Property Sheet, click the Data tab, click Record Source and type e (make sure Elements has been selected)
  11. On the form, click the first Unbound text box (on the right side of  Text0)
  12. In the Data tab of the Property Sheet, click Control Source
  13. Click the arrow of the Control Source combo box and select AtomicNumber
  14. On the form, click the next Unbound text box
  15. In the Data tab of the Property Sheet, click Control Source.
    Click the arrow of the Control Source combo box and select Symbol

The Caption of a Windows Control

A caption is the word or group of words that displays on a control. If you drag a control from the Field List to a form or report, the control would use the caption set in the table for the field. Remember that if no caption was set for the field, the name is used as the caption. At any time, you can change the caption to your liking..

The controls that have a caption have a property named Caption in the Property Sheet.

Practical Learning: Setting Objects Captions

  1. On the form, click the first label (probably Text0)
  2. In the Property Sheet, click Format and click Caption
  3. Type Element #:
  4. On the form, click the other label (probably Text2)
  5. In the Property Sheet, click All and Caption
  6. Type Symbol:
  7. Close the form
  8. When asked whether you want to save, click Yes
  9. In the Navigation Pane,  right-click the Elements table and click Design View
  10. Click the empty cell under Symbol
  11. Type ElementName and press the down arrow key
  12. In the cell under ElementName, type AtomicMass and press F6
  13. Click Caption and type Mass
  14. In the same way, set the Caption of AtomicNumber as Atomic #
  15. Close the table
  16. When asked whether you want to save, click Yes
  17. In the Navigation Pane, double-click the Elements form to open it
  18. Right-click its tab and click Design View
  19. In the Tools section of the Design tab of the Ribbon, click Add Existing Fields
  20. From the Field List, drag ElementName and drop it on the form
  21. Notice that the accompanying label has a caption that is the same as the field name
  22. From the Field List, drag AtomicMass and drop it on the form
  23. Notice that it has its own caption
  24. On the form, click the left ElementName
  25. Click the left ElementName again to put it into edit mode
  26. Click between t and N, and press the Space bar
  27. Click an unoccupied area of the form to dismiss the selection
  28. Press Ctrl + A to select all controls
  29. On the Ribbon, click Arrange
  30. In the Table section, click Stacked
  31. Close the form
  32. When asked whether you want to save, click Yes
  33. On the Ribbon, click File and click Open
  34. In the list of files, click Ceil Inn1 from the previous lesson
  35. On the Ribbon, click Create
  36. In the Forms section, click Form Design
  37. Double-click the button at the intersection of the rulers.
    In the Property Sheet, click the Data tab.
    Click Record Source and type m (make sure MaritalsStatus has been selected)
  38. In the Design tab of the Ribbon, in the Tools section, click Add Existing Fields
  39. In the Field List, double-click MaritalStatusID
  40. On the form, click inside the left MaritalStatusID (the label) and edit it to display Marital Status ID
  41. In the Field List, double-click MaritalStatus
  42. On the form, click inside the left MaritalStatus (the label) and edit it to display Marital Status
  43. Close the form
  44. When asked whether you want to save the form, click Yes
  45. Set the form name as MaritalsStatus and press Enter

Data Entry on a Form

Introduction

Data entry on a form is performed using Windows controls. If the control is a text box, click it and type the value. As you may know already, most controls are accompanied by a label. You can click that label to give focus to the control. If a control is a list, you will be asked to make a selection.

After entering or changing data on a control, to move from one field to the next, the surest way is to press Tab. In some cases, the user can also press Enter.

Practical Learning: Form Data Entry

  1. On the Ribbon, click File and click Open
  2. In the list of files, click Cruise1 (otherwise, open the Cruise1 database)
  3. In the Navigation Pane, under Carriers, double-click the Carriers form
  4. On the form, click the text box on the right side of Ship Code
  5. Type ELR-086
  6. Press Tab
  7. In the Ship Name text box, type Ocean Bayonne
  8. Click Port of Registry and type Miami, FL
  9. To close the form, click its close button Close
  10. On the Ribbon, click File and click Open
  11. In the list of files, click Chemistry1
  12. In the Navigation Pane, double-click the Elements form to open it
  13. Create a few records as follows:
     
    Element # Symbol Element Name Mass
    1 H Hydrogen 1.00794
    2 He Helyum 4.002602
    3 Li Lithium 6.941
    4 Zi Xylophate 9.50242
    5 B Boron 10.811
    6 C Carbon 12.0107
  14. On the Ribbon, click File and click Open
  15. In the list of files, click StatesStatistics1 from the previous lesson
  16. In the Navigation Pane, right-click the States form and click Design View
  17. Double-click the left StateName (the label) to access its properties
  18. In the Property Sheet of the label, click Format if necessary.
    Click the text in the Caption field and remove State to have Name

    The Captions of Windows Controls

Controlling Data Entry on a Form

One of the most important roles of a form is to provide a friendly means of performing data entry. Probably the most fundamental aspect of a form is to prevent an asthetic display of records to the user. As such, a form is not necessary made for data entry. In fact, you can prevent the user from creating records using a form. This is controlled by a Boolean property named Allow Additions. Therefore, to prevent the user from creating new records using a form, open the form in Design View and access its Property Sheet. In the Data or the All tab, set the Allow Additions field to No.

Practical Learning: Controlling Data Entry on a Form

  1. On the Ribbon, click File and click Open
  2. In the list of files, click Ceil Inn1 used earlier
  3. In the Navigation Pane, double-click the MaritalsStatus form to open it
  4. In the bottom section of the form, click the New (Blank) Record
  5. In the new record, click Marital Status
  6. Type Widow and press Tab
  7. Right-click the title bar of the form and click Design View
  8. Double-click the button at the intersection of the rulers
  9. In the Property Sheet, click Data if necessary.
    Double-click Allow Additions to set its value to No
  10. Right-click the title bar of the form and click Form View
  11. In the bottom section of the form, Notice that the New (Blank) Record button is disabled.
    Still in the bottom section of the form, click the Last Record button
  12. Press Tab to try to get to a new record
  13. On the Ribbon, click File and click Open
  14. In the list of files, click Cruise1 (from the previous lesson)
  15. When asked whether you want to save the changes to the form, click Yes
  16. In the Navigation Pane, right-click the CruiseShips form and click Open
  17. After viewing the form, right-click its body and click Design View
  18. Double-click the button at the intersection of the rulers.
    In the Property Sheet, click Data and click Record Source
  19. Click the arrow of Record Source and select CruiseShips
  20. On the Ribbon, click Design if necessary.
    In the Tools section of the Ribbon, click Add Existing Fields
  21. In the Field List, click ShipCode
  22. Press and hold Shift
  23. Click Decks
  24. Release Shift
  25. Drag the selected fields to the form and release the mouse
  26. Move the selection to the top-left of the form so it aligns with 2 measures from left according to the horizontal ruler and 2 measures from top according to the vertical ruler
  27. Click an unoccupied area of the form to dismiss the selection
  28. On the form, double-click Ship Code to open its Property Sheet
  29. In the Property Sheet, click the Format tab.
    Click Width and type 1.20
  30. On the form, click ShipCode
  31. In the Width field of the Property Sheet, type 1.25
  32. Inside the horizontal ruler, click above Ship Code to select the labels
  33. On the Ribbon, click Arrange
  34. In the Size & Ordering section, click Size/Space and click To Widest
  35. Inside the horizontal ruler, click above ShipCode to select the text boxes
  36. Right-click one of the selected controls, position the mouse on Size and click To Widest
  37. On the Ribbon, click Design
  38. In the Tools section of the Ribbon, click Add Existing Fields
  39. In the Field List, click PortOfRegistry
  40. Press and hold Shift
  41. Click Capacity
  42. Release Shift
  43. Drag the selected fields to the right side of the form and release the mouse
  44. Move the selection to the right side of the other controls on the form to align the selection with the 3 mark + 2 measures of the horizontal ruler and 2 measures from the top inside the vertical ruler
  45. Click an unoccupied area of the form to dismiss the selection
  46. On the form, double-click Port of Registry (on the left side of PortOfRegistry) to access its properties
  47. In the Property Sheet, click the Format tab.
    Click Width and type 1.35
  48. Click Left and type 3
  49. On the form, click PortOfRegistry
  50. In the Width field of the Property Sheet, type 1.35
  51. Inside the horizontal ruler, click above Port of Registry to select the right-side labels
  52. On the Ribbon, click Arrange
  53. In the Size & Ordering section, click Align and click Left
  54. Still in the Size & Ordering section, click Size/Space and click To Widest
  55. Inside the horizontal ruler, click above PortOfRegistry to select the text boxes
  56. Right-click one of the selected controls, position the mouse on Size and click To Widest
  57. To preview, right-click the title bar of the form and click Form View
  58. After viewing, right-click the title bar of the form and click Design View

The Font Applied to a Windows Control

Introduction

The font is the design used to paint text of the control on a form or a report. The appearance of a control of a form or a report can be improved with an appropriate font. To change the font of a control, first display its form or report in Design View:

The font you apply to any control on a form or a report doesn't have any influence on the columns of the base table.

Practical Learning: Specifying the Font of a Control

  1. The CruiseShips form should still be opened in Design View.
    To select all controls on the form, press Ctrl + A
  2. On the Ribbon, click Home
  3. In the Text Formatting section, click the arrow of the Font combo box and select Comic Sans MS (if you don't have that font, select Tahoma)

The Font Size of a Control

To change or set the size of the font used to display the characters of a control on a form or a report:

Practical Learning: Setting the Font Sizes of Controls

  1. All controls should still be selected on the form (otherwise, press Ctrl +A to select them).
    On the Ribbon, click Format
  2. In the Font section, click the arrow of the Font Size combo box and select 12

The Text Style of a Control

To change the font style of a control, switch the form or report to Design View. Select the control or the group of controls. On the Ribbon, click either Home or Format. In the Text Formatting section of the Home tab or in the Font section of the Format tab, click the button that represents the desired style: Bold Bold, Italic Italic, or Underline Underline.

Instead of the buttons on the Ribbon, you can apply a style or a combination of styles using the Property Sheet. In the Property Sheet, click either the Format or the All tab:

Practical Learning: Setting the Font Style of a Control

  1. The CruiseShips form should still be opened in Design View.
    Inside the horizontal ruler, click above Ship Code to select the left-side labels
  2. On the Ribbon, click Home
  3. In the Text Formatting section, click the Bold button Bold
  4. Inside the horizontal ruler, click above Port of Registry to select the right-side labels
  5. In the Property Sheet, click Format if necessary and click Font Weight
  6. Click the arrow of the combo box and select Bold

The Text Alignment of a Control

The text alignement specifies on what side the value of a field would be displayed, to the left, to the center, or to the right within the area allocated to the control. To specify the text alignment of a control:

Practical Learning: Aligning Fields Text

  1. On the Ribbon, click File and click Open
  2. In the list of files, click StatesStatistics1
  3. When asked whether you want to save the changes on the form, click Yes
  4. In the Navigation Pane, right-click the States form and click Design View
  5. On the form, click the left Abbreviation (the label)
  6. Press and hold Shift
  7. Click Name
  8. Click the left Capital
  9. Release Shift
  10. On the Ribbon, click Format
  11. In the Font section of the Ribbon, click the Align Right button Align Left

    The Text Alignment of a Control

  12. On the Ribbon, click File and click Open
  13. In the list of files, click Cruise1
  14. When asked whether you want to save the changes on the form, click Yes

Introduction to Colors and Windows Controls

Text Color

The color applied to the text of a control specifies the perception of red-green-blue that the control will show. To specify or change the color of text of a control:

Practical Learning: Setting Text Font on Fields

  1. In the Navigation Pane, right-click the CruiseShips form and click Design View
  2. To select all controls on the form, press Ctrl + A
  3. On the Ribbon, click Home
  4. In the Text Formatting section, click the arrow of the Font Color button and select Dark Blue, Text 2, Lighter 80% (Theme Colors: 4th column - 2nd row)
  5. Click inside the horizontal ruler above ShipCode to seleft the left-side text boxes
  6. On the Ribbon, click Format
  7. In the Font section, click the arrow of the Font Color button and select Blue (Standard Colors: 8th column - 7th row)
  8. Click inside the horizontal ruler above PortOfRegistry to select the right-side text boxes
  9. In the Property Sheet, click All
  10. Click Fore Color and click browse button
  11. In the window that appears, select Blue (Standard Colors: 8th column - 7th row)
  12. To preview, right-click the title bar of the form and click Form View
  13. On the Ribbon, click File
  14. In the list of files, click StatesStatistics1
  15. When asked whether you want to save, click Yes
  16. In the Navigation Pane, right-click the States form and click Design View

The Background Color of a Control

The background color specifies the color used behind the text, or on the body, of a control. To specify or change the background color of a control, if the color you want to use is one of the Microsoft Access-defined colors, on the form or the report, right-click a control or one of the selected control, position the mouse on Fill/Back Color, and click the desired color. Otherwise:

Practical Learning: Setting the Background Color

  1. Click the body of the form to select the Detail section
  2. On the Ribbon, click Format
  3. In the Font section, click the down-pointing arrow of the Background Color and select Blue, Accent 5, Darker 50% (Theme Colors: 9th column, 6th row)

    The Background Color of a Windows Control

  4. On the Ribbon, click Format and, in the Selection section, click Select All
  5. Still in the Format tab of the Ribbon, in the Font section, click the arrow of the Font combo box and select Century (if you don't have that font, select Times New Roman)
  6. Inside the horizontal ruler, click above State to select (only) the labels

    The Background Color of a Windows Control

  7. In the Font section of the Ribbon, click the arrow of the Font Size combo box and select 12
  8. While the labels are still selected, in the Font section of the Ribbon, click the arrow of the Font Color button and select Blue, Accent 1, Lighter 80% (Theme Colors: 5th column, 2nd row)
  9. On the form, click the right Abbreviation (the text box)
  10. Press and hold Shift
  11. Click StateName
  12. Click the right Capital
  13. Release Shift

    The Background Color of a Windows Control

  14. In the Font section of the Ribbon, click the arrow of the Font Color button and select Black, Text 1 (Theme Colors: 2nd column, first row)
  15. On the form, click State
  16. In the Font section of the Ribbon, click the Bold button
  17. While the sections titles are still selected, in the Font section of the Ribbon, click the arrow of the Font Color button and select Yellow (Standard Colors: 4th column, 7th row)

    The Background Color of a Windows Control

  18. On the Ribbon, click File and click Open
  19. In the list of files, click Ceil Inn1
  20. When asked whether you want to save, click Yes
  21. In the Navigation Pane, right-click the Occupancies form and click open
  22. After viewing the form, right-click the title bar of the form and click Design View
  23. Double-click the button at the intersection of the rulers
  24. In the Property Sheet, click Data and click Record Source
  25. Click the arrow of Record Source and select Occupancies
  26. On the Ribbon, click Design if necessary.
    In the Tools section, click Add Existing Fields
  27. From the Field List, drag OccupancyNumber and drop it on the form under the Detail bar (no precision needed)
  28. Double-click the button at the intersection of the rulers

A Transparent Control

If you don't want a control to be painted with a particular color, you can make it transparent. To do this, right-click the control on the form or report. Position the mouse on Fill/Back Color, and click Transparent:

Colors.

Alternatively, in the Property Sheet, click the Back Style field, then click the arrow of its combo box and select Transparent.

Practical Learning: Setting the Transparency of a Control

  1. On the form, click OccupancyNum to select the text box
  2. In the Property Sheet, click Format and click Back Style
  3. Click the arrow of Back Style and select Transparent
  4. On the Ribbon, click File and click Open
  5. In the list of files, click StatesStatistics1
  6. When asked whether you want to save, click Yes
  7. In the Navigation Pane, right-click the States form and click Design View

The Borders of a Windows Control

The Thickness of a Border

To indicate its limits, a control is surrounded by a border. By default, the border appears as a solid line. To specify or change the thickness of the borders of a control or a group of controls, first select it or select them. Then:

Line Thickness

Border Width

The Line Type of a Border

Besides the thickness, you can control the border of an object with a style. To do this, first select the control or a group of controls. Then:

Line Type

Border Style

The available options are:

Line Types

The Border Style characteristic can be used in combination with the Special Effect property. Some of these effects depend on the Special Effect value and may not appear as expected.

The Border Color property can be used to control the color used to draw the border of a label or a field. It is used as we described for the Fore Color property.

The Border Width property is used as the Line/Border Width button of the Formatting toolbar.

The Border Color of a Control

To paint the borders of a control with a color of your choice. First select a control or a group of controls. Then:

Special Effects

The special effect is a small feature that makes it possible to display a section of a form/report or a control flat, sunk, or raised.

To apply the special effects to a control, first select the control or a group of controls. Then:

Special Effects

The available options are:

Special Effects

Practical Learning: Using Special Effects

  1. On the form, click State
  2. In the Property Sheet, click Format and click Special Effect
  3. Click the arrow of the Special Effect combo box and select Chiseled

    Special Effects

  4. To preview the form, right-click its tab and click Form View

    States Statistics

  5. Save and close the form
  6. On the Ribbon, click File and click Open
  7. In the list of files, click Ceil Inn1
  8. In the Navigation Pane, right-click the Occupancies form and click Design View
  9. On the Ribbon, click File and click Open
  10. In the list of files, click Chemistry1
  11. In the Navigation Pane, right-click the Elements form and click Design View
  12. Complete the design of the form as follows:

    Chemistry - Form Design

  13. Save and close the form

Using a Pre-Design

Copying a Design

Microsoft Access makes it possible to copy a design from one control to another. To do this, in the Design View of a form or report, click the control that has the desired design. On the Ribbon, click Home. In the Clipboard section, click the Format Painter button. On the form or report, click the control on whic you want to apply the design.

Using a Design Template

Microsoft Access provides sets of fonts and colors you can apply to the controls on a form or report. To apply them, the form or report must be displayed in Design View. The options are available in the Themes section of the Design tab of the Ribbon.

To a apply a common font to all controls on the form or report, in the Themes section of the Ribbon, click Fonts and click the desired font. The colors are provided as a set for different sections and controls:

Colors

A theme is a combitation of a font and colors. To apply a theme, in the Themes section of the Ribbon, click Themes and select the desired option:

Theme

Interface Characteristics of Windows Controls

The Visibility of a Windows Control

By default, when you add a control to the form or report, that control would appear to the user. For various reasons, you may not want the user to see a certain control. In this case, you can hide that control.

The visibility or disappearance of a Windows control can be controlled independently from its corresponding column on a table. To let you control the visibility of a control, the Property Sheet is equipped with the Visible Boolean property. If you set the Visible property to No (the default is Yes, the control would be hidden.

The Status Bar of a Form

As mentioned for a table, when a control receives focus on a form, you can display some helpful text on the status bar. You can take care of this aspect on the table as we saw already. When the corresponding Windows control on the form receives focus, the same text would display on the status bar of the form.

In this case, you must create the Description feature of the field on the table before adding the corresponding control to the form. If you did not create the status bar text in the table, or you created that status bar text after adding the corresponding control to the form, you can still create the text to display on the status bar of the form.

To create a status bar text for a field on a form, while in Design View, access the Property Sheet for the control. In the Other or the All tab, enter a sentence in the Status Bar Text property.

The Availability of a Control

A control is said to be enabled if the user can interact with it. For example, by default, the user can change the text of a text box or make a selection from another type on control. If a control is disabled, the user cannot change its text or change its selection

To let you control the availability of an object, the Property Sheet is equipped with a Boolean field named Enabled.

Practical Learning: Disabling a Control

  1. On the Ribbon, click File and click Open
  2. In the list of files, click Ceil Inn1
  3. In the Navigation Pane, right-click the Occupancies form and click Design View
  4. On the form, click OccupancyNum to select the text box
  5. In the Property Sheet, click Data if necessary.
    Click Enabled, then click its arrow and select No

Locking a Control

A control is said to be locked if the user cannot change the value of the control in Form View. To lock a control, after selecting it in Design View, access its Boolean Locked property in the Property Sheet and set it to Yes (the default value is No).

Practical Learning: Locking a Control

  1. The OccupancyNumber control should still be selected on the form (otherwise, select it).
    In the Data tab of the Property Sheet, double-click Locked to set its value to Yes
  2. In the Property Sheet, click Format
  3. Click Special Effect and set its value to Chiseled
  4. Close the form
  5. When asked whether you want to save, click Yes
  6. On the Ribbon, click File and click Open
  7. In the list of files, click Road System1 from the previous lesson
  8. In the Navigation Pane, right-click the Roads form and click Design View
  9. Click one of the controls on the form and click the cross cursor on their left to select all controls
  10. On the Ribbon, click Arrange
  11. In the Table section, click Remove Layout Remove Layout
  12. On the Ribbon, click Design
  13. In the Tools section, click Add Existing Fields
  14. From the Field List, drag Location and drop it on the form
  15. Complete the design of the form based on your tastes. Here is an example:

    Form Design

  16. Close the form
  17. When asked whether you want to save, click Yes
  18. On the Ribbon, click File and click Open
  19. In the list of files, click FunDS1 (from Lesson 5)
  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 Properties
  23. In the Propert Sheet, click Data and, in the Record Source, select Employees
  24. Save the form as Employees
  25. In the Design tab of the Ribbon, in the Tools section, click Add Existing Fields
  26. In the Field List, double-click EmployeeNumber
  27. In the Field List, double-click FirstName
  28. In the Field List, double-click LastName
  29. In the Field List, double-click Title
  30. Design the form as you like (for our form, the Back Color of the Form Header section is set to #C1B995, the Back Color of the Detail section is set to #DDD9C3, the Back Color of the Form Footer section is set to #663300)

    Form Design

  31. To perform data entry, right-click the title bar of the form and click Form View
  32. Create the following records:
     
    Employee # First Name Last Name Title
    402446 Catherine Watts Owner - General Manager
    275594 Claire Roberts Sales Associate
    702048 Jennifer Harrison Sales Manager
    927486 Amanda Aronson Sales Associate
  33. Save and close the form
  34. In the Navigation Pane, double-click the ShoppingSessions table
  35. Create the following records:
     
    Receipt # Employee #
    100001 402446
    100002 402446
    100003 702048
    100004 275594
    100005 927486
    100006 702048
  36. Close Microsoft Access

Previous Copyright © 2002-2021, FunctionX, Inc. Next