The Forms of a Database Application: Dialog Boxes



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

Code Builder

The title bar on top of a 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.

Modal Dialog Boxes

A dialog box is referred to 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.

Modal Dialog Box

Practical Learning Practical Learning: Creating a Dialog Box

  1. Select the CleaningOrders form and click the button at the intersection of its rulers
  2. To convert it into a dialog box and make other changes, change its properties as follows:
    Auto Center: Yes
    Border Style: Dialog
  3. Switch the form to Form View
  4. Click the created Close button
  5. When asked whether you want to Save, click Yes
  6. Right-click the Central form and click Form Header/Footer
  7. In the toolbox, click the Command Button and click the right side of the Footer section
  8. In the first page of the wizard, click Form Operations then Close Form, and click Next
  9. In the second page of the wizard, change the string in the text box to Close and click Next
  10. In the third page of the wizard, change the name to cmdClose and click Finish
  11. Save and close the form
  12. Close the database

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:

Modeless 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.


Previous Copyright © 2005-2015, FunctionX Next