Lessons Logo

Form Design

Forms Properties

Introduction

A form appears to be the most regularly used object of a Microsoft Access database. Although there are various means of quickly creating a form, as we saw with the Form Wizard or AutoForm and their variations, at times you will need to further customize the appearance of a form to the user as this can affect the overall understanding of your product.

A form by itself is presented as a rectangular object that shares many of the characteristics of a regular container: a system icon, a title bar, one or more system buttons, borders, corners, and a body. Depending on the role of your form, you may want to design forms that present differing characteristics, even if these forms belong to the same database. For example, while one form presents a normal title bar, you may want another form not to present a title bar at all. While you may allow the user to be able to minimize or maximize a form, you may want to present one or both of these actions for the user. As an application design environment, Microsoft Access provides most of the features you will need for a regular and even advanced database product.

Practical Learning: Introducing Details of Form Design

  1. From the resources that accompany our lessons, copy the Video Collection1 database and paste it in your Exercises folder
  2. Open the Video Collection1 database
  3. To create a new form, on the main menu, click Insert -> Form
  4. In the New Form dialog box, click Form Wizard to select it. In the bottom combo box, select Videos and click OK
  5. In the first page of the wizard, click the select all button and click Next
  6. In the second page, make sure the Columnar radio button is selected and click Next
  7. In the third page of the wizard, click Standard and click Next
  8. In the fourth page, accept the suggested name as Videos and click Finish
  9. After viewing the form, close it
  10. In the Database window, click Forms.
    To create a new form, on the Database toolbar, click the arrow of the New Object button and click Form
  11. In the New Form dialog box, click Design View. In the bottom combo box, select Actors and click OK
  12. Save the form as Actors
  13. Open the Bethesda Car Rental1 database and, in the Database window, click the Forms button
  14. To create a new form, on the main menu, click Insert -> Form
  15. In the New Form dialog box, make sure nothing is selected in the combo box and double-click Design View
  16. Save the form as About and close it

Form Automatic Centering

If you either create a new form or modify the design of an existing form, when you save it, Microsoft Access saves the position of the form then would remember and restore that position the next time you reopen the form. Alternatively, you can ask Microsoft Access to position the form in the center of the screen the next time you open the form, even if it was on one corner of the screen when you saved.

To center the form by default whenever it comes, set its Auto Center Boolean property to Yes.

As we have seen so far, the top section of a form is its title bar. It displays an icon on the left side. The system icon is fixed and you should not spend time trying to change it. As mentioned already, the system icon holds a menu that allows the user to perform the regular operations of a Windows container, including minimizing, maximizing, restoring or closing the window. To display this menu, the user can click the form’s system icon:

The presence of the form’s system icon is partly controlled by the Control Box property of a form. In most cases, you should make this system icon and its menu available to the user. If for some strange reason you do not want to provide this functionality, set the Control Box property to No. The form would appear as follows:

If you decide to do this, make sure you provide the user with the ability to close the form and this type of title bar makes it impossible. Of course, a user may know that the form can be closed by clicking the Close menu item under the File group of the main menu or by pressing Ctrl+F4.

The Title Bar

The middle section of the title bar is actually referred to as the title bar. It can be used to change the view of the form after right-clicking it. The title bar uses a color set in the Advanced Appearance of Control Panel as Active Title Bar:

Since you cannot control and cannot predict how your users will modify their system colors (because most users are free to set their system colors as they wish, even when they work corporate), you should refrain from changing this color when designing your forms, especially if you plan to distribute your product. Otherwise, the result you see on your form may be different from your users computers (and this can invite trouble with users telephone calls asking you why Leonie's form appears with a different color than mine; what did I do to deserve this? Why does everybody hate me?).

When designing your forms, try to keep colors to their default and to their minimum. In this lesson, we are showing most options simply to let you know that they exist, not because you should or must use them.

Practical Learning: Using the Form’s Title Bar

  1. Open the Video Collection1 database
  2. On the Database window, in the Forms section, right-click the Videos form and click Design View
  3. Double-click the button at the intersection of both rulers to open the form’s Properties window. In Properties window, click the Format property page and click Caption
  4. Type Video Collection – Video Details and press Enter.
    If you are using Microsoft Access 2000 and above, click the Other tab of the Properties window. Click the arrow of the Allow Design Changes combo box and select Design View Only
  5. Switch to Form View to preview the form
  6. Save and close the form
  7. Right-click the Actors form and click Design View
  8. In Properties window, click the Format tab and click Caption
  9. Type Video Collection – Actors/Actresses and press Enter
  10. Save and close the form
  11. Open the Bethesda Car Rental1 database
  12. In the Database window, right-click the About form and click Design View
  13. In the Format tab of the Properties window, click Caption.
    Type About Bethesda Car Rental and press Enter
  14. Save and close the form

The System Buttons

The right side of the form’s title bar displays three system buttons , or , . The group of these buttons is called the Control Box. If you do not want these system buttons at all, access the Properties window of the form and set the Control Box Boolean property to No from its Yes default value. In this case, the form would appear with neither the system icon nor the system buttons as seen above. Once again, if you do this, make sure the user has a way to close the form.

Instead of completely hiding all system buttons of a form, you can specify which ones to display and thus control the ability to close, minimize, or maximize the form. The presence and/or the role of the system buttons is (partly) controlled by the Control Box and the Min Max Buttons properties. When the Control Box property is set to No, regardless of the value of the Min Max Buttons property, there would be no system buttons on the title bar (this is also something you learn if you do Windows GUI programming, like Win32). Therefore, in order to control the appearance and behavior of the system buttons, the Control Box property must be set to Yes. The values of the Min Max Buttons produce the following results:

Min Max Buttons Result System Buttons Consequence
Minimize Maximize Close
None Hidden Hidden Available The form can only be closed
Min Enabled Enabled Disabled Available The form can be minimized or closed but not maximized
Max Enabled Disabled Enabled Available The form cannot be minimized but can be maximized
Both Enabled Enabled Enabled Available All operations (minimize, maximize, restore, and close) are allowed

Depending on the role and probably the number of Windows controls on a form, you will decide what button to allow or not.

Practical Learning: Configuring the Form’s System Buttons

  1. Open the Video Collection1 database
  2. Forms section of the Database window, right-click the Videos form and click Design View
  3. In the Properties window, click the Min Max Buttons field. Click its arrow and select Min Enabled
  4. Switch to Form View to preview the form and try to maximize the form
  5. Save and close the form
  6. Right-click the Actors form and click Design View
  7. In the Format tab of the Properties window, double-click Min Max Buttons a few times (2) until it displays Min Enabled
  8. Save and close the form

The Form’s Borders

Whether you allow the system icon and system buttons or not, the user needs to be able to know where a form starts and where it ends. This is seen by the borders of the form. In most cases, you will not be concerned with this aspect. Otherwise, you can control the borders of a form.

The borders of a form are controlled using the Border Style property. If you set it to None, the form would appear without borders:

  The Form's Width

A form displays on the screen using its dimensions. These are the width and height. The form itself controls only the width. The height is controlled by its sections. To change the width of a form, in the Properties window, type the desired decimal value in the Width field of the Format property page. You can also change the form's width by dragging the right border of one of its sections.

Practical Learning: Setting the Form’s Width

  1. Open the Actors form in Design View and, in the Properties Window, click the Format tab
  2. Click Width. Type 5.72 and press Enter
  3. Save and close the form
  4. In the Forms section of the Database window, right-click the Actors form and click Design View
  5. Position the mouse on the right border of the Detail section until the mouse cursor turns into a cross with two horizontal arrows:
     
  6. Click and drag in the left direction until the vertical line is positioned at 31/2
     
  7. Release the mouse
  8. Save and close the form

The Detail Section

The most obvious part of a form is an area called Detail. This section starts on a bar labeled Detail and ends at the bottom unless a new section starts. The Detail section serves as the main host of other controls. It can also serve to display messages of various kinds. The Detail section can be enhanced by manipulating its properties. These properties are not necessarily related to the parent form but can be used conjointly with it.

During our first design experience of forms, we learned that the form itself controls its width. The vertical dimension of a form is controlled by its sections. This means that a section, such as the Detail section, can "decide" how much height it needs to accommodate its content. The vertical measurement of the Detail section is controlled by the Height property. There are two main ways you can change the Detail section's height at design time:

Practical Learning: Using the Detail Section of a Form

  1. Open the Videos form in Design View and double-click an empty area under the Detail bar
  2. On the Properties window, click the Format tab. Click Height and type 2.75
  3. Click the Back Color field and click its ellipsis button
  4. In the Color dialog box, click the Define Custom Colors >> button. Set the color to Red = 255, Green = 232, and Blue = 200
  5. Click OK
  6. While the new color has been set, click Back Color to select the color and press Ctrl + C
  7. Switch to Form View to preview the form
  8. Save the form and close it
  9. Open the Actors form in Design View and click the Detail bar
  10. In the Format tab of the Properties window, click Back Color. Press Ctrl + V and press Enter
  11. Switch to Form View to preview the form
  12. Save and close the form

The Header and Footer Sections

Besides the Detail section, a form can be enhanced with one or two more sections: Header and Footer. By default, the Header and Footer sections are created on a form if you use the Form Wizard.

To add the Header and Footer sections on a form that doesn't have them, you can use the menu bar where you would click View -> Form Header/Footer. Probably the fastest way to add these sections is by right-clicking anywhere on the form and clicking Form Header/Footer. If the form already has these sections but they don't contain anything, they would be removed. If the form already has these sections and they contain anything, you would receive a warning:

If you still want to delete the Header and Footer sections, you can click Yes; this would un-recoverably delete their content. Like the Detail section, the Header and Footer sections control their own height, which you can change the same way we described above for the Detail section. This also applies for the Back Color property. The Special Effect property allows you to raise or sink a section.

Practical Learning: Designing the Header and Footer Sections

  1. In the Database window, click Tables and click the Directors table to select it
  2. On the Database toolbar, click the arrow of the New Object button and click Form
  3. In the New Form dialog box, click Form Wizard. In the bottom combo box, make sure the Directors table is selected and click OK
  4. In the first page of the wizard, click the select all button and click Next. In the second page of the wizard, make sure the Columnar radio button is selected and click Next. In the third page, click Standard and click Next. In the fourth page, accept the suggested name as Directors and click Finish
  5. Switch the form to Design View and notice that the form displays a Form Header and a Form Footer bars
  6. To change the height of the Form Header section, position the mouse between the Form Header and the Detail bars until the mouse cursor turns into a cross with two vertical arrows
     
  7. Click and drag down until the horizontal line is positioned between the first and the second marks
     
  8. Release the mouse
  9. To heighten the Form Footer section, position the mouse on the lower border of the Form Footer bar
     
  10. Drag down until the horizontal line is positioned on the third mark and release the mouse
     
  11. Save and close the form
  12. From the Forms section of the Database window, right-click Actors and click Design View
  13. To add the other sections, on the main menu, click View -> Form Header/Footer
  14. Click the section between the Form Header and Detail bars. Notice that the Header bar has been clicked to show that it is selected
  15. On the Properties window, click the Format tab and click Height, type .385
  16. Click Back Color and click its ellipsis button
  17. Click Define Custom Color >>. Change the color values as follows: Red = 240, Green = 140, and Blue = 0
  18. Click OK
  19. On the Format property page of the Properties window, click Special Effect
  20. Click the arrow of the Special Effect combo box and select Raised
  21. Click the Form Footer bar to select its section
  22. On the Format tab of the Properties window, change the Height value to .345 and press Enter
  23. On the Formatting toolbar, click the arrow of the Fill/Back Color button and click the Brown color (1st row - 2nd column)
     
  24. On the Formatting toolbar, click the arrow of the Special Effect button and select Raised
  25. Switch to Form View to preview the form
     
  26. Save the form and close it
  27. Open the Bethesda Car Rental1 database
  28. From the Forms section of the Database window, right-click the About form and click Design View
  29. To add the sections to the form, right-click anywhere on the form and click Form Header/Footer
  30. Save and close the form

Record Selectors

The Record Selector is a vertical bar on the left side of a form. It allows the user to select all of the fields’ contents of one or more records and copy them to the clipboard. Such a selection can then be pasted to another record, other records, or to a text or another type of file (for example you can paste the record in Notepad, Microsoft Word, Microsoft Excel, or any text file).

There are two reasons you would use record selectors on a form. If you want the user to be able to access all fields of a record as a whole, make sure that the form is equipped with record selectors. In the same way, you can hide the scroll bar if the user would not need them. Another reason you would use a record selector is for aesthetic reasons. Most of the time, if designing a form for data entry, you would mostly allow the presence of record selectors. If you are designing a dialog box that would display the same content all the time, you should not allow the record selectors.

The presence or absence of record selectors is controlled by the Boolean Record Selectors property field. If you set the field value to Yes, the form would display the record selector. Setting the field value to No would hide the record selectors.

Practical Learning: Toggling the Record Selectors

  1. Open the Bethesda Car Rental1 database
  2. In the Forms section of the Database window, right-click the About form and click Design View
  3. In the Properties window, click the Format tab. Double-click Record Selectors to change its value to No (from its default Yes)
  4. Switch to Form View to preview the form
  5. Save and close the form

The Form's Scroll Bars

As much as you can, you should design your (non-Datasheet) form to display all of the fields of a record whenever the/a record comes up. Sometimes this will not be possible. If a form possesses too many fields for each record, Microsoft Access would equip the form with one or two scroll bars. A scroll bar allows the user to scroll from one side of the form to another. The vertical scroll bar is used to scroll up and down while the horizontal scroll allows scrolling left and right.

By default, scroll bars come up if the form "judges" that some fields are hidden. The presence of scroll bars allows the user to be aware of hidden fields. Depending on your design, you can control the appearance or disappearance of the scroll bars. To do this, change the value of the Scroll Bars field in the Format property page of the Properties window. There are four possible values. To display only the vertical scroll bar, set the value to Vertical Only. In the same way, you can display only the vertical scroll bar by selecting Horizontal Only. On the other hand, you can display both scroll bars by setting the value to Both. If for some reason you don't want any scroll bar, set the Scroll Bars property value to Neither.

Practical Learning: Configuring a Form’s Scroll Bars

  1. The Bethesda Car Rental1 database should still be opened. In the Forms section of the Database window, double-click the Customers2 form to open it
  2. Notice that the form displays a vertical scroll bar on the right side.
    Switch the form to Design View
  3. In the Format tab of the Properties window, click Scroll Bars. Then click the arrow of the Scroll Bars combo box and select Neither
  4. Switch to Form View to preview the form. Notice that, this time, the vertical scroll bar has disappeared
  5. After viewing the form, save and close it

Navigation Buttons

When studying tables and during form's data entry, we found out that a form (also a table, a query, or a report) is equipped with some buttons on its lower section. These buttons allow the user to navigate back and forth between records. These buttons are very useful during data entry and data analysis. If you are creating a form that would display the same content all the time, such as a form that does not actually display records, you can hide the form navigation buttons.

The presence or absence of navigation buttons is controlled by the Boolean Navigation Buttons property. When its value is set to Yes, the form would display the Navigation Buttons. To hide them, set the Navigation Buttons property value to No.

Practical Learning: Hiding the Navigation Buttons

  1. In the Forms section of the Database window, double-click the About form to open it. Notice that it is equipped with navigation buttons
  2. Switch the form to Design View
  3. In the Format tab of the Properties window, double-click Navigation Buttons to change its value from Yes to No
  4. Switch the form to Form View to preview it. Notice the absence of navigation buttons
  5. After viewing the form, save and close it

Dividing Lines

A form is equipped with special horizontal lines used to visually separate sections of a form. They do not perform any other special function. They can be useful on a continuous form.

To equip a form with dividing lines, add a header and a footer sections. On the other hand, if you create a form that is directly equipped with a header and a footer sections, it would display the dividing lines.

The presence or absence of the horizontal lines is controlled by the Boolean Dividing Lines property. Its default value is Yes, which means that the dividing horizontal lines would display on the form. To hide both lines, you can set its value to No. To hide an individual line, you can completely reduce its section.

Practical Learning: Using Dividing Lines

  1. From the Forms section of the Database window, double-click the About form to open it.
  2. Switch it to Design View. If it is not equipped with Form Header and Form Footer bars, right-click anywhere on the form and click Form Header/Footer. Switch it back to Form View
  3. Notice that it is equipped with horizontal dividing lines
     
  4. Switch the form to Design View
  5. To remove the line that divides the Form Header and the Detail sections, click the Form Header bar
  6. In the Format tab of the Properties window, click Height. Type 0 and press Enter
  7. Switch the form to Form View to preview. On the main menu, click Window -> Size To Fit Form.
    Notice that, this time, the form displays only a lower dividing line.
  8. Save and close the form

Dialog Boxes

 

Introduction

A dialog box is a rectangular object that is used to host or carry other controls without itselft being hosted by another object:

A dialog box is primarily characterized by two main features: its title bar and its body. The title bar, on top of the dialog box, has a title and the system close button (only, mostly). Although this is the classic appearance of a dialog box, it is not strictly exclusive. Some dialog boxes display the system icon. On the right side of the title bar, a classic dialog box displays only the system Close button made of X. Again, this is not exclusive. It is not unusual for a dialog box to display the minimize and the maximize/restore buttons but, according to Microsoft standards, a dialog box should appear as the one above: no system icon, only the system Close button, and a type of border referred to as Dialog Frame.

To use a dialog box, the user must open it one way or another. Your job is to decide how and when the user will be able to open a dialog box.

To create a dialog box in Microsoft Access, you start from a form and display it in Design View. To convert an existing form into a dialog box, set its Border Style property to Dialog. This reduces the system buttons to the Close button only.

There are two types of dialog boxes: modal and modeless.

Practical Learning: Creating a Modal Dialog Box

  1. The Bethesda Car Rental1 database should still be selected.
    On the Database window, double-click the About form to open it
  2. After viewing it, switch it to Design View
  3. In the Format tab of the Properties window, click Border Style. Then click the arrow of the Border Style field and select Dialog
  4. Switch it to Form View to preview
  5. Save and close the form
  6. To create a new form, in the Forms section of the Database Window, click New
  7. In the New Form dialog box, make sure the bottom combo box is empty and double-click Design View
  8. Save the form as RentalRates
  9. On the Properties window, click the Format tab and click Caption
  10. Type Bethesda Car Rental - Rental Rates and press Enter
  11. Click Width. Type 3.875 and press Enter
  12. To make this form a dialog box, in the Format tab of the Properties window, change the following properties:
    Record Selectors = No
    Navigation Buttons = No
    Dividing Lines = No
    Border Style = Dialog
  13. Click the Detail bar to select it. Then, in the Format tab of the Properties window, click Height. Type 1.875 and press Enter
  14. Preview, save, and close the form

Modal Dialog Boxes

A dialog box is characterized as modal if the user must close it before continuing with another task on the same application.

The Date and Time dialog box of WordPad is an example of a modal dialog box: if opened, the user must close it in order to continue using WordPad. 

In order to use a dialog box in your application, you should analyze a scenario and define if the dialog box is necessary. Use a dialog box if you want the user to first terminate whatever task she would be performing. For example, if a user is performing a payment of an order processing, it is natural to process and finish that payment before starting another task.

A classic (or normal) dialog box would need

neither a Record Selectors bar nor the record navigation buttons. Therefore, you should decide how the dialog box would be used. If you want a regular dialog box as defined by the Microsoft standards, you should set the Record Selectors, the Navigation Buttons and the Dividing Lines properties to No each.

Practical Learning: Creating a Modal Dialog Box

  1. The Bethesda Car Rental1 database should still be opened.
    Open the About dialog box in Design View
  2. On the Properties window, click the Other tab
  3. Double-click Modal to change its value from No to Yes
  4. Switch the dialog box to Form View to preview
  5. Try clicking the Forms button of the Database window. Notice that the dialog box is modal
  6. To save it, press Ctrl + S. Then close the About dialog box

Modeless Dialog Boxes

A dialog box is referred to as modeless if the user doesn't have to close it in order to continue using the application that owns the dialog box:

The Find dialog box of WordPad (also the Find dialog box of most applications) is an example of a modeless dialog box. If it is opened, the user doesn't have to close in order to use the application or the document in the background. 

Since the modeless dialog box doesn't display its button on the task bar, the user should know that the dialog box is opened. To make the presence of a modeless dialog box obvious to the user, it typically displays on top of its host application until the user closes it.

To create a modeless 

dialog box, or to convert a form into a modeless dialog box, when in Design View, set the Popup property to Yes. This makes sure that the user can work on another form and the modeless dialog box or form would remain on top of any other form of the database.

Practical Learning: Creating a Modeless Dialog Box

  1. The Bethesda Car Rental1 database should still be opened.
    Open the RentalRates form in Design View. If you did not design your own RentalRates form, use the RentalRates1
  2. To make it a modeless dialog box, in the Other tab of the Properties window, double-click Pop Up to change its value from No to Yes
  3. Save and close the RentalRates dialog box
  4. Open the OrderProcessing form. Without closing it, from the Database window, double-click the RentalRates dialog box to open it
  5. Move the OrderProcessing form around and notice that it is always behind the Rental Rates dialog box
  6. Close the OrderProcessing form and close the Rental Rates dialog box
 

MOUS Topics

S29 Use form sections (headers, footers, and detail)
 

Exercises 

Watts A loan

  1. Open the Watts A Loan database and open the Customers form in Design View.
    Disable the Maximize button on the form and set its Caption to 
    Watts A Loan - Customers Account Information
    Make the form center when it comes up
    Add the Form Header and Footer sections
    Raise the Form Header and the Form Footer sections. Change the Form Header's background color to Gray 50%. Set the Form Footer's background color to Gray 80%
     
  2. Use the same features to configure the employees form but set its Caption to 
    Watts A Loan - Employees Records
    Design the other forms accordingly
     
     
     

     

Yugo National Bank

  • Open the Yugo National Bank
    Make all forms center themselves when they appear
    Add a Form Header and a Form Footer to all forms
    Disable the Maximize buttons on the Customers and the Employees forms
    Give a Dialog Border Style to the AccountTypes, the ChargeReasons, and the TransactionTypes forms
    Make the ChargeReasons form Modal
     
     
     
     
     
 

Previous Copyright © 2002-2019, FunctionX Next