Microsoft Access Lessons Home

Database Fields on Forms and Reports

 

Common Fields of Forms and Reports

 

Introduction

As we saw in previous lessons, fields are created on a table, then they can be added to a query. Based on the way Microsoft Access deals with fields, a field on a table cannot be created as a combination of other fields, as if it were an expression (unless the field is created as "lookup")(We know that other database environments, including Microsoft SQL Server and MySQL, allow using an expression as the value of a column of a table but MS Access doesn't). Instead, the fields on a table are primarily created to store data. On the other hand, as we will see in the next few lessons, a new field can be added to a query as a combination, through an expression, of other fields. Forms and reports present this same solution. Besides using the fields of a table or a query, a new field can be added to a form or report. This is because forms and reports use objects called Windows controls.

Labels

A label is a static object that presents a word or a group of words. The user cannot (directly) change the value that a label is displaying. By default, a label displays its sentence on a gray background.

Text Boxes

A text box is a rectangular object with a white background and thick borders. On a form, a text box either presents information to the user, requests data from the user, or does both. On a report, a text box is used like a label: to display information that would be printed.

A text box may not be explicit enough to indicate what it is used for. For this reason, it is usually positioned next to a label. The label is usually positioned on top, or to the left, of the text box it is accompanying. For this reason, a text box is named after the label close to it. For example, and throughout this site, if a text box is placed under, or on the right side of, a label that displays First Name, the text box would be called "The First Name Text Box".

Combo Boxes

A combo box is a type of text box that displays an item selected from a list it is holding. On a form, to change an item in a combo box, you can click its arrow and make your selection from the list. On a report, a combo box appears as such only when in design. When printed, only its data displays. Although it depends on the programmer's configuration of the combo box, the user may not be allowed to enter in a combo box something that is not part of the preset list.

 
 

Navigation Buttons

Forms and reports are equipped with the same navigation buttons used on tables (and queries). This time, they are used to navigate left and right to the previous or the next records instead of up and down.

Object Role
First Record: allows moving to the first record
Previous Record: allows moving one record back (if there is one) from the current record
Record Indicator: Displays the number representing the current record
Next Record: allows moving one record ahead
Last Record: Allows moving to the last record
New Record: Used to enter a new record for a form
Since you cannot create a new record on a report, this button is not available on it
 

Practical Learning: Reviewing Controls on Forms and Reports

  1. Open the Rockville Techno database that you started in Lesson 2
  2. On the Database window, click the Forms button. Then double-click the Clients form to open it 
  3. On the Clients form, click the Time Cards button
     
  4. Notice the Employee and Date Entered labels
  5. Also notice the Employee combo box
  6. Notice also the Date Entered, the Total Hours, and the Total Expenses text boxes
 

Forms Fields

 

Introduction

Microsoft Access is an MDI application. This means that it allows you to open many objects, such as different forms and/or reports at the same time. This lets you switch from one window to another to perform data entry on related objects.

A form, by design, provides a friendlier interface and should make its navigation easy for the user. To provide this functionality, a form can be equipped with various types of Windows controls. Some of the objects are used only to display information to the user. Some others allow the user to change data.

Sub-Form

A sub-form is a form that is “glued” or embedded in another form. It is used to display related data that would otherwise be accessible from another form.

Record Selector

A form is equipped with a special area that allows selecting the currently displaying record. The Record Selector is on the left side immediate to the left border of the form. The Record Selector is not available on all forms. The database developer decides on its availability or not.

Practical Learning: Reviewing Controls on Forms

  1. Notice the Time Worked and the Expenses sub forms
  2. To view the design of subform, right-click the title bar of the Time Cards form and click Form Design
     
  3. After viewing the form, right-click its title bar and click Form View

Reports and Controls

 

Introduction

Like a form, a report uses the same label, text box, combo box, and list box controls. As mentioned already, the appearance of the controls may not be printed as we will see when studying properties of controls, the background and borders of controls can be changed for aesthetic reasons. Such background and borders would be printed.

Sub-Report

A sub-report is a report added to a parent report in a master-detail layout. It allows the user to view related data from different tables to create a more realistic report. Although playing the same roles, sub-forms and sub-reports are not created the exact same way.

Practical Learning: Reviewing Controls on Reports

  1. On the Time Cards form, click the Preview Time Card button
  2. To view the design of a sub-report, on the main menu, click View -> Design View
  3. Notice the Time and Expenses sub-reports in the Detail section
  4. To preview the report, on the main menu, click View -> Print Preview
     
  5. Close the Time Sheet report
  6. Close the Time Cards form
  7. Close the Clients form
 

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