The Form View
To create a form view:
If the form exists already or if you are designing the form, in the Property Sheet of the form, click Format and set the Default View to Single Form:
Charateristics of a Form View
A form should have a tab or a title bar. If you want to allow the user to select one or more records, the form view should have a record selector, which is controlled by the Record Selectors property.
A form behaves like a wizard, which is a windows made of contiguous pages that follow one another. As we know already, to move from one record to another, the user can click the navigation buttons in the bottom part of the form.
A Form for Data Entry
To create a new record, the user can click the New (Blank) Record button and start typing. Microsoft Access provides an alternative that allows you to present a ready-made form to the for data entry only. The most important characteristics of this form is that its Data Entry field in the Property Sheet must be set to Yes.
To create a form specially made for data entry, start or display a form in Design View. In the Property Sheet, set the following characteristics:
Introduction to the Tabular Form
A tabular form displays its data in rows, that is, many records in the same view:
Actually, a tabular form displays its record in a section. Instead of showing one record at a time, the form can show as many records as its size allows. Here is an example:
This type of form is referred to as continuous because the records are displayed continuously in the same view. If the number of records is not too high, all of them would display. If there are more records than the form's size can allow to view, some records would be hidden. To view them, you can use the scroll bars.
Introduction to Creating a Tabular Form
To create a tabular form:
If the form exists already or if you are designing the form, in the Property Sheet of the form, click Format and set the Default View to Coontinuous Forms
Creating a Tabular Form from Juxtaposed Controls
A tabular form has its controls positioned next to each other in their respective sections. This means that they appear like cells of a table. Instead of adding and positioning them manually, Microsoft Access provides faster means. To proceed, select the control. Then, in the Table section of the Arrange tab of the Ribbon, click Tabular .
To select the controls of a juxtaposed group, click one of them and click the cross cursor on the left. As an alternative, click one of the controls. On the Ribbon, click Arrange and use the buttons in the Rows & Column section.
Characteristics of a Tabular Form
A tabular form has some characteristics that set it apart from the Form View. For example, a tabular form should (must) have a form header and a Detail section. It can also have a form footer section. When desining the form, you should (must) put the labels of the controls in the form header.
The Record Selectors
On a tabular form, the record selector is the box on the left side of each individual record. This means that the view of the form can display many record selectors, one for each record:
The Alternate Color
An alternate color is one that displays in every other record. For example, if you create a tabular form or report, you can make all rows show their backgrounds in the same color. Here is an example:
To make even rows show their background in one color and odd rows show their background in another color, first set the background color as seen in the previous section. For the alternate color, display the form or report in Design View. On the Ribbon, click Format:
Here is an example:
Practical Learning: Setting the Alternate Color
The Navigation Buttons
Remember that all records of a tabular form displayin the same view. For this reason, when desigging the form, you should set its Navigation Buttons to No.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.
Practical Learning: Hiding the Navigation Buttons of a Form
A datasheet form displays exactly like a table. To create a datasheet form:
You can also display any form in Datasheet View. To do this:
On a datasheet form, the record selector is the same as for a table in datasheet view.
Characteristics of a Datasheet Form
A datasheet form is primarily designed like a Form View. This means that during designs, you can include the form header and the footer sections. You can then add the controls as you see fit. When the form displays, only the controls of the Detail section will display. This is not an anomaly but made by design. For example, you can add controls in the form footer section so that those control would hold values that you are aware of and can use in your expressions but the user doesn't need to see such values or controls.
A Split Form
A split form is made of two sections:
To automatically generate a split form, in the Navigation Pane, click the table that holds the records. Then, on the Ribbon, click Create. In the Forms section, click Split Form. To create a split form by design, start a form in Design View or display an existing form in Design View. In the Property Sheet of the form, set its Record Source to the table that holds the value andset its Default Value to Split Form. If it is a brand new form without some previously created fields, use the Field List to add the desired fields to it.
Sub-Forms (and Sub-Reports)
A sub-form (or a sub-report) is a form (or a report) that is position on the body of another form (or another report). In order to "include" one form (or report) into another form (or report), both objects must have a relationship. The form (or report) that is hosting the other form (or the other report) is the parent and has (or must have) a primary key. The form (or report) that is added to the parent is called the child form (or child report) and must have a foreign that will communicate with the primary key of the parent table.
Microsoft Access Automatic Sub-Forms
Microsoft Access provides various techniques you can use to create a sub-form. The simplest technique consists of using a wizard. To generate a form that contains a sub-form, start the Form Wizard. In the first page of the wizard, in the Tables/Queries combo box, select the parent object and, in the Available Fields list, select the fields you want to display on the form. Then, in the Tables/Queries combo box again, select the child list. In the Available Fields list, select the fields that the sub-form should display. Continue with the wizard. In the second page, you must be able to identify the relationship that will control the link between both lists. In other words, you must be able to identify the primary key from the parent table and the foreign key from the child table. Once this is clear, you can continue. In the third page of the wizard, you will decide how you want the subform to display, as a tabular list or as a datasheet. After making this decision, you can continue.
Practical Learning: Automatically Creating an Auto-Subform
Sub-Forms and Sub-Report Design
The alternative to the Form Wizard is to design your own sub-form or sub-report. You have various options:
A sub-form can be created as a tabular form. To use a tabular form as sub-form, its record source must include a foreign key that corresponds to the primary key of the record source of the hosting form.
Practical Learning: Creating and Using a Sub-Form
A Datasheet as a Sub-Form
A sub-form can be presented as a datasheet, in which case it would display exactly like a table, a series of columns and cells.
A dialog box is a rectangular object that is used to host or carry other controls:
Creating a Dialog Box
To create the dialog box, start a form in Design View. To convert an existing form into a dialog box, set its Border Style property value 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
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.
Modeless Dialog Boxes
A dialog box is referred to as modeless if the user does not have to close it in order to continue using the application that owns the dialog box. To create a modeless dialog box, or to convert a form into a modeless dialog box, in Design View, set the Popup property (Other and All tabs) to Yes.
Practical Learning: Creating a Modeless Dialog Box
A Message Box
A message box is a smaller and simpler version of a dialog box. It is used to display a piece of information to the user. The message box is equipped with a button the user can click to dismiss the message box.
Creating a Message Box
Unlike a form or a dialog box, a message box is not designed. Instead, to create a message box, you use MsgBox() (in the next lesson, we will see where you can type it. In the parentheses, enter the message you want to display. Obviously the message is provided as t3ext. Therefore it should be included inside double-quotes.
Practical Learning: Ending the Lesson