Designing Forms

Most important terms

Form

A window provided for easy data entry and presentation on the computer screen.

Form's data source

Database table or query providing data displayed in the form. The data source is needed because forms itself are only tools for displaying and entering data, while tables and queries are the source of data. New, empty forms have no data source assigned, so they are not displaying any data from your database unless you assign a data source to them.

Form field

Direct equivalent of a column in a table or query. Most frequently used are fields for displaying text and numbers. Entering a new value or changing the existing value of such a field causes a change in the bound table or query column (after accepting the change).

Form design

Tasks you are performing to define the appearance and functions of the form. To do this, you need to provide data source, insert form fields of various types and place them at the appropriate location.

Form widget

Form's element. Main widget types are:

  • Widgets displaying information, e.g. a text box or an image box. Each widget of this type can be bound to a data source field (a table or a query column). Therefore, such widgets are called in short form fields.

  • Widgets able to perform a specified action, e.g. a push button that can close the current form. Within other applications this widget type is sometimes called form control because it can perform previously defined action of controlling your database application's behavior.

  • Other widgets allowing to enrich a form's appearance, e.g. a “line widget” can visually separate two form areas.

Container widget

A widget that can contain other widgets within its area. For example, frame widget or tab widget are containers. The form's surface itself is a container as well. A command button cannot be called as container because it is not possible to insert a widget inside it. In more complex cases, container widgets can be inserted inside a container, so nesting is possible.

Forms versus tables

In chapter 5.2 you learned about how to enter data directly into tables using their data sheet view. However, in many cases forms are better suited for data entry:

  • A table can contain too many columns to display them on your screen. A form can display such a data using multiple rows.

  • A form allows to visually split data fields into logical groups, thus increasing readability. Labels with additional information can be inserted to give users more hints on how to use the form or what given data fields mean.

  • Command buttons can be used within forms for commonly used commands so users can use forms in a similar way as a standalone applications they know.

  • In data sheet view displaying multi-row data text fields or images is as easy as within forms.

Working with form design

As with table or query design, you are able to use Data View and Design View. Form designing is performed in Design View. We will often refer to the form design window as to Form Designer.

  1. To create a new empty form, select Insert-> Form from the Menubar. Optionally, you can use New Form command from drop-down button on the Project Navigator's toolbar or Create Object: Form command from the context menu.

  2. A new frame will appear, you can resize the form by moving the borders. The form is covered with a grid which simplifies accurate positioning of the widgets.

As with table design, Form Designer provides Property pane. To save some space on the screen, the pane has three tabs related to the currently selected form:

The Properties tab

Contains a list of properties for the currently selected widget.

The Data source tab

Contains properties related specifically to the data source of the currently selected widget or the form itself.

The Widgets tab

Contains a hierarchy of all widgets of the form. The list simplifies widgets lookup by name and navigation between them.

There is information about currently selected widget's name and type displayed on the first and second tab.

Additional toolbars are also available:

  • The Widgets toolbar used for inserting new widgets into the form

  • The Format toolbar used to format form's elements (e.g. adjusting widget's size, grouping). Formatting commands are also available in the Format menu. More about these commands can be found in the section called “The Format Menu”.

Using the Widgets tab

The Widgets tab in the Property pane provides a list of form widgets and their hierarchy. Each widget is presented within the hierarchy beside other widgets being on the same level (the same parent container). Child widgets (inside containers) are presented using indented names.

Each widget has displayed its name and type. The type has also an icon displayed - the same as the one displayed on the toolbar used while form designing is performed.

Note

  • Changing the current selection on the list causes appropriate selection on the designed form. This allows for easier widget lookup by name and easier navigation. For example, it is possible to select a widget by name, and then switch to the Properties tab to change the widget's properties.

  • Keeping the Ctrl key pressed while an item on the widgets list is being selected allows to select multiple widgets at a time. Keeping the Shift key pressed allows to select entire lists of widgets.

Giving widgets reasonable names can be useful but is not mandatory. Note that widget's name is a property that is not visible to the user of your form. Users will only see a widget text, provided by Text property or similar.

Inserting widgets - text fields

Let's create a form providing information about persons, i.e. a form connected it with Persons table.

If the form being designed should present data obtained from the database, you need to place appropriate fields on it. To do this, use the buttons on the Widgets toolbar. Each button corresponds to a single widget type.

  1. Click Text Box button on the Widgets toolbar.

  2. Click on the form surface with the left mouse button. A new text box widget will be placed in the point where you clicked. Before you release you can drag your mouse to specify a desired size for the widget.

  3. If needed, move the inserted widget using drag & drop to a desired position. You can resize the widget afterwards by dragging one of the small boxes appearing near its corners. Note that the boxes are only visible when the widget is selected. If you select another widget or the form surface, the boxes disappear.

  4. Click the Text Box toolbar button again and click on the form surface to insert another widget. Repeat this action once again until you get three text boxes inserted in your form. For sake of simplicity we will limit ourselves to three data fields.

Note

  • There is a context menu available in form's design mode, activated by a right mouse button click the desired widget or the form's surface. The menu offers commands like Cut, Copy, Paste, Delete and other, more complex. Many of the commands are also provided in the Menubar, usually Edit. Keyboard shortcuts are also available for these commands. Some of the commands are only available for certain types of widgets.

  • The commands Cut, Copy and Paste makes it possible to move or copy widgets between forms, even between separate database projects.

  • Holding the Ctrl key down while clicking a widget allows to select multiple widgets.

  • Instead of using Copy and Paste commands, to duplicate a widget within the same form you can hold down the Ctrl key while moving the widget. After the Ctrl key is released, the dragged widget will not be moved but copied in the new location.

Assigning data sources

The fields you inserted have no data source assigned yet, so these are not able to display information from the database. To assign data source, use the Data Source tab of the Property pane.

The very first step is to specify the form's data source, i.e. a place the displayed data will be fetched from. As mentioned above, you will use table persons as a data source for your new form.

  1. Click on the form's surface, as you will alter its properties.

  2. Switch to the Data Source tab and enter persons table name in the Form's data sourcee.g. a “line widget” can visually separate two form areas.

Container widget

A widget that can contain other widgets within its area. For example, frame widget or tab widget are containers. The form's surface itself is a container as well. A command button cannot be called as container because it is not possible to insert a widget inside it. In more complex cases, container widgets can be inserted inside a container, so nesting is possible.

Forms versus tables

In chapter 5.2 you learned about how to enter data directly into tables using their data sheet view. However, in many cases forms are better suited for data entry:

  • A table can contain too many columns to display them on your screen. A form can display such a data using multiple rows.

  • A form allows to visually split data fields into logical groups, thus increasing readability. Labels with additional information can be inserted to give users more hints on how to use the form or what given data fields mean.

  • Command buttons can be used within forms for commonly used commands so users can use forms in a similar way as a standalone applications they know.

  • In data sheet view displaying multi-row data text fields or images is as easy as within forms.

Working with form design

As with table or query design, you are able to use Data View and Design View. Form designing is performed in Design View. We will often refer to the form design window as to Form Designer.

  1. To create a new empty form, select Insert-> Form from the Menubar. Optionally, you can use New Form command from drop-down button on the Project Navigator's toolbar or Create Object: Form command from the context menu.

  2. A new frame will appear, you can resize the form by moving the borders. The form is covered with a grid which simplifies accurate positioning of the widgets.

As with table design, Form Designer provides Property pane. To save some space on the screen, the pane has three tabs related to the currently selected form:

The Properties tab

Contains a list of properties for the currently selected widget.

The Data source tab

Contains properties related specifically to the data source of the currently selected widget or the form itself.

The Widgets tab

Contains a hierarchy of all widgets of the form. The list simplifies widgets lookup by name and navigation between them.

There is information about currently selected widget's name and type displayed on the first and second tab.

Additional toolbars are also available:

  • The Widgets toolbar used for inserting new widgets into the form

  • The Format toolbar used to format form's elements (e.g. adjusting widget's size, grouping). Formatting commands are also available in the Format menu. More about these commands can be found in the section called “The Format Menu”.

Using the Widgets tab

The Widgets tab in the Property pane provides a list of form widgets and their hierarchy. Each widget is presented within the hierarchy beside other widgets being on the same level (the same parent container). Child widgets (inside containers) are presented using indented names.

Each widget has displayed its name and type. The type has also an icon displayed - the same as the one displayed on the toolbar used while form designing is performed.

Note

  • Changing the current selection on the list causes appropriate selection on the designed form. This allows for easier widget lookup by name and easier navigation. For example, it is possible to select a widget by name, and then switch to the Properties tab to change the widget's properties.

  • Keeping the Ctrl key pressed while an item on the widgets list is being selected allows to select multiple widgets at a time. Keeping the Shift key pressed allows to select entire lists of widgets.

Giving widgets reasonable names can be useful but is not mandatory. Note that widget's name is a property that is not visible to the user of your form. Users will only see a widget text, provided by Text property or similar.

Inserting widgets - text fields

Let's create a form providing information about persons, i.e. a form connected it with Persons table.

If the form being designed should present data obtained from the database, you need to place appropriate fields on it. To do this, use the buttons on the Widgets toolbar. Each button corresponds to a single widget type.

  1. Click Text Box button on the Widgets toolbar.

  2. Click on the form surface with the left mouse button. A new text box widget will be placed in the point where you clicked. Before you release you can drag your mouse to specify a desired size for the widget.

  3. If needed, move the inserted widget using drag & drop to a desired position. You can resize the widget afterwards by dragging one of the small boxes appearing near its corners. Note that the boxes are only visible when the widget is selected. If you select another widget or the form surface, the boxes disappear.

  4. Click the Text Box toolbar button again and click on the form surface to insert another widget. Repeat this action once again until you get three text boxes inserted in your form. For sake of simplicity we will limit ourselves to three data fields.

Note

  • There is a context menu available in form's design mode, activated by a right mouse button click the desired widget or the form's surface. The menu offers commands like Cut, Copy, Paste, Delete and other, more complex. Many of the commands are also provided in the Menubar, usually Edit. Keyboard shortcuts are also available for these commands. Some of the commands are only available for certain types of widgets.

  • The commands Cut, Copy and Paste makes it possible to move or copy widgets between forms, even between separate database projects.

  • Holding the Ctrl key down while clicking a widget allows to select multiple widgets.

  • Instead of using Copy and Paste commands, to duplicate a widget within the same form you can hold down the Ctrl key while moving the widget. After the Ctrl key is released, the dragged widget will not be moved but copied in the new location.

Assigning data sources

The fields you inserted have no data source assigned yet, so these are not able to display information from the database. To assign data source, use the Data Source tab of the Property pane.

The very first step is to specify the form's data source, i.e. a place the displayed data will be fetched from. As mentioned above, you will use table persons as a data source for your new form.

  1. Click on the form's surface, as you will alter its properties.

  2. Switch to the Data Source tab and enter persons table name in the Form's data sourcee.g. a “line widget” can visually separate two form areas.

Container widget

A widget that can contain other widgets within its area. For example, frame widget or tab widget are containers. The form's surface itself is a container as well. A command button cannot be called as container because it is not possible to insert a widget inside it. In more complex cases, container widgets can be inserted inside a container, so nesting is possible.

Forms versus tables

In chapter 5.2 you learned about how to enter data directly into tables using their data sheet view. However, in many cases forms are better suited for data entry:

  • A table can contain too many columns to display them on your screen. A form can display such a data using multiple rows.

  • A form allows to visually split data fields into logical groups, thus increasing readability. Labels with additional information can be inserted to give users more hints on how to use the form or what given data fields mean.

  • Command buttons can be used within forms for commonly used commands so users can use forms in a similar way as a standalone applications they know.

  • In data sheet view displaying multi-row data text fields or images is as easy as within forms.

Working with form design

As with table or query design, you are able to use Data View and Design View. Form designing is performed in Design View. We will often refer to the form design window as to Form Designer.

  1. To create a new empty form, select Insert-> Form from the Menubar. Optionally, you can use New Form command from drop-down button on the Project Navigator's toolbar or Create Object: Form command from the context menu.

  2. A new frame will appear, you can resize the form by moving the borders. The form is covered with a grid which simplifies accurate positioning of the widgets.

As with table design, Form Designer provides Property pane. To save some space on the screen, the pane has three tabs related to the currently selected form:

The Properties tab

Contains a list of properties for the currently selected widget.

The Data source tab

Contains properties related specifically to the data source of the currently selected widget or the form itself.

The Widgets tab

Contains a hierarchy of all widgets of the form. The list simplifies widgets lookup by name and navigation between them.

There is information about currently selected widget's name and type displayed on the first and second tab.

Additional toolbars are also available:

  • The Widgets toolbar used for inserting new widgets into the form

  • The Format toolbar used to format form's elements (e.g. adjusting widget's size, grouping). Formatting commands are also available in the Format menu. More about these commands can be found in the section called “The Format Menu”.

Using the Widgets tab

The Widgets tab in the Property pane provides a list of form widgets and their hierarchy. Each widget is presented within the hierarchy beside other widgets being on the same level (the same parent container). Child widgets (inside containers) are presented using indented names.

Each widget has displayed its name and type. The type has also an icon displayed - the same as the one displayed on the toolbar used while form designing is performed.

Note

  • Changing the current selection on the list causes appropriate selection on the designed form. This allows for easier widget lookup by name and easier navigation. For example, it is possible to select a widget by name, and then switch to the Properties tab to change the widget's properties.

  • Keeping the Ctrl key pressed while an item on the widgets list is being selected allows to select multiple widgets at a time. Keeping the Shift key pressed allows to select entire lists of widgets.

Giving widgets reasonable names can be useful but is not mandatory. Note that widget's name is a property that is not visible to the user of your form. Users will only see a widget text, provided by Text property or similar.

Inserting widgets - text fields

Let's create a form providing information about persons, i.e. a form connected it with Persons table.

If the form being designed should present data obtained from the database, you need to place appropriate fields on it. To do this, use the buttons on the Widgets toolbar. Each button corresponds to a single widget type.

  1. Click Text Box button on the Widgets toolbar.

  2. Click on the form surface with the left mouse button. A new text box widget will be placed in the point where you clicked. Before you release you can drag your mouse to specify a desired size for the widget.

  3. If needed, move the inserted widget using drag & drop to a desired position. You can resize the widget afterwards by dragging one of the small boxes appearing near its corners. Note that the boxes are only visible when the widget is selected. If you select another widget or the form surface, the boxes disappear.

  4. Click the Text Box toolbar button again and click on the form surface to insert another widget. Repeat this action once again until you get three text boxes inserted in your form. For sake of simplicity we will limit ourselves to three data fields.

Note

  • There is a context menu available in form's design mode, activated by a right mouse button click the desired widget or the form's surface. The menu offers commands like Cut, Copy, Paste, Delete and other, more complex. Many of the commands are also provided in the Menubar, usually Edit. Keyboard shortcuts are also available for these commands. Some of the commands are only available for certain types of widgets.

  • The commands Cut, Copy and Paste makes it possible to move or copy widgets between forms, even between separate database projects.

  • Holding the Ctrl key down while clicking a widget allows to select multiple widgets.

  • Instead of using Copy and Paste commands, to duplicate a widget within the same form you can hold down the Ctrl key while moving the widget. After the Ctrl key is released, the dragged widget will not be moved but copied in the new location.

Assigning data sources

The fields you inserted have no data source assigned yet, so these are not able to display information from the database. To assign data source, use the Data Source tab of the Property pane.

The very first step is to specify the form's data source, i.e. a place the displayed data will be fetched from. As mentioned above, you will use table persons as a data source for your new form.

  1. Click on the form's surface, as you will alter its properties.

  2. Switch to the Data Source tab and enter persons table name in the Form's data sourcee.g. a “line widget” can visually separate two form areas.

Container widget

A widget that can contain other widgets within its area. For example, frame widget or tab widget are containers. The form's surface itself is a container as well. A command button cannot be called as container because it is not possible to insert a widget inside it. In more complex cases, container widgets can be inserted inside a container, so nesting is possible.

Forms versus tables

In chapter 5.2 you learned about how to enter data directly into tables using their data sheet view. However, in many cases forms are better suited for data entry:

Working with form design

As with table or query design, you are able to use Data View and Design View. Form designing is performed in Design View. We will often refer to the form design window as to Form Designer.

  1. To create a new empty form, select Insert-> Form from the Menubar. Optionally, you can use New Form command from drop-down button on the Project Navigator's toolbar or Create Object: Form command from the context menu.

  2. A new frame will appear, you can resize the form by moving the borders. The form is covered with a grid which simplifies accurate positioning of the widgets.

As with table design, Form Designer provides Property pane. To save some space on the screen, the pane has three tabs related to the currently selected form:

The Properties tab

Contains a list of properties for the currently selected widget.

The Data source tab

Contains properties related specifically to the data source of the currently selected widget or the form itself.

The Widgets tab

Contains a hierarchy of all widgets of the form. The list simplifies