|Microsoft Office Access 2003
Microsoft Access 97, 2000, and 2002
In Access, you can enter data directly into the tables in a database. However, you can make the process of entering and working with data much easier and more accurate if you use forms. You can create three types of forms in Access:
- Data-entry forms You use data entry forms to add data to your database, or view, edit, and delete existing data.
- Switchboards You create switchboards to simplify the process of starting the various forms and reports in a database. For example, when you start the Northwind sample database, a switchboard appears and allows you to take a variety of actions such as starting forms or reports.
- Custom dialog boxes You create dialog boxes when you need to act on user input. For example, you can create search dialog boxes that prompt users for search parameters, and then return data that match those parameters.
Tip In Access 2010, you can create a "navigation form" which provides an intuitive tabbed interface for switching between forms and reports. Watch a video or try Office 2010!
Facts to remember about data-entry forms
Keep these facts in mind as you learn about data forms:
- Don't confuse Access forms with, for example, form letters created with Microsoft Word. They aren't the same thing. If you need sample form letters, resumes, invoices, or other types of documents, visit the Microsoft Office Online Templates page. You can download templates and modify them to suit your needs. While you can't open those types of templates in Access, you can use them as models to design similar forms for your databases.
- Don't confuse an Access form with an Access report. You use forms to work with the data in a database. You use reports to print and distribute the information in a database. For example, you could use reports to create a product catalog or a quarterly sales summary.
- If you want to print mailing labels, you must create a report, not a form. For information about creating and printing mailing labels, see Create mailing labels.
How forms work
A form has one or more controls that display or accept the information that you want to enter or change. For example, a "Customer" form might have a "Name" text box control that you use to enter and view customer names, an "Address" text box control for entering and viewing customer addresses, a "Discontinued" check box control to indicate whether a current customer is current, and so on.
In Access, you can create two types of forms — bound and unbound.
Bound forms You create a bound form when you want to enter, edit, and otherwise work with data stored in a table or query. The controls on a bound form remain connected to the fields in a table or query. For example, the "Name" text box control on the "Customer" form is bound to the Name field in the Customers table. When you open the form, the "Name" text box shows the first customer's name. When you edit the contents of the text box, Access updates the Name field of the corresponding customer record in the Customers table.
For more information on how add and edit data using bound forms, see Add, edit, and delete data.
Unbound forms An unbound form is not connected to any of the tables or queries in a database. You cannot enter or view data in a database with an unbound form. Instead, you use unbound forms for tools such as switchboards and dialog boxes. A switchboard is a form that provides a menu of tasks when you open a database. For more information on switchboards, see the section titled, "A switchboard form" later in this topic. A dialog box is a window that prompts you with a message, such as "Do you want to close the database?" Neither the message string nor your input is stored in a table or query. For more information on dialog boxes, see the section title "Custom dialog box" later in this topic.
Types of forms
You can create different types of forms in Access to meet a variety of requirements. You can create a form that is based on multiple tables, one that has multiple pages or tabs, or one that displays a menu of choices.
A form based on more than one table or query
Using a form wizard is the simplest and fastest way to create a form that brings data together from more than one table or query. When you use a form wizard to select fields from more than one table or query, Access creates a flat form, a hierarchical form, or a synchronized form, and writes an SQL statement to bind the form to its record source. The SQL statement includes the information about which tables, queries, and fields to use.
Flat form A simple form that contains controls that are bound to different tables and queries. An example of a flat form is a form that shows products and product suppliers.
The data in these fields comes from the Products table.
The data in these fields comes from the Suppliers table.
Hierarchical form A form that contains one or more embedded forms. An embedded form is also called a subform. Subforms are useful when you want to show data from tables that have a one-to-many relationship. For example, you could have a "Categories" form that includes data from a Categories table and a Products table.
Data in these fields comes from the Categories table — the "one" side of the one-to-many relationship.
Data in these fields comes from the Products table — the "many" side of the one-to-many relationship.
For more information on creating a hierarchical form, see the following topics:
Synchronized form You may want to present your data hierarchically without using a subform. For example, if you have a form with multiple controls, you may not have adequate room for a subform. In this case, you can use a form wizard to create synchronized forms. When you click a command button on one form, Access opens another form that is synchronized with the record on the first form.
This form displays data from the Suppliers table — the "one" side of a one-to-many relationship.
...displays related records from the Products table — the "many" side of a one-to-many relationship.
For more information on how to create these forms, see the topic Create a form.
A form with multiple pages or tabs
Form with multiple pages You can create a form with multiple pages by using the page break control. The page break control marks a horizontal break between controls or groups of controls on a form. When you press the PAGE UP or PAGE DOWN keys, Access scrolls to the page before or after the page break control.
Form with tabs You can create a form with tabs by using the tab control. Using a tab control is the easiest and most effective way to create a multiple-page form.
General employee information is displayed on this page.
Personal employee information, such as home address and phone number, is displayed on this page.
For more information on how to create forms with multiple pages or tabs, see the following topics:
A pop-up form or custom dialog box
Pop-up form You can create a pop-up form to display information to a user or to prompt a user for input. A pop-up form stays on top of other open forms, even when another form is active. A pop-up form can be modal (modal: A window or dialog box that requires the user to take some action before the focus can switch to another form or dialog box. Dialog boxes and messages are usually modal.) or modeless. A modal pop-up form is also called a custom dialog box.
When a pop-up form is modeless, you can access other objects and menu commands while the form is open. For example, on the "Suppliers" form, you could add a command button that displays a product list pop-up form. The pop-up form displays the products available from the current supplier in the Suppliers form.
This button displays the modeless pop-up form.
A modeless pop-up form stays on top of other forms, but you can move the focus to another window without closing the form.
Custom dialog box When a pop-up form is modal, you can't access any other objects or menu commands unless you hide or close the form. For example, you could create a custom dialog box that asks which report you want to print.
A custom dialog box stays on top of other windows, and you can't move the focus to another window unless you close or hide the form.
For more information on how to create pop-up forms or custom dialog boxes, see the following topics:
A switchboard form
When you use the Database Wizard to create a database, Access automatically creates a switchboard that helps you navigate around the database. The switchboard has buttons that you can click to open forms and reports (or open other switchboards that contain additional forms and reports), quit Access, or customize the switchboard. You can create a switchboard similar to the one that the Database Wizard creates by using the Switchboard Manager.
Note To find the Switchboard Manager command:
- In Access 2000 and later, point to Database Utilities on the Tools menu.
- In Access 97, point to Add-Ins on the Tools menu.
Note Switchboard forms reside with the other forms in your database. To find a switchboard form, in the Database window, click Forms under the Objects bar on the left.
A form in a PivotTable or PivotChart view
You can open a bound form in PivotTable view or PivotChart view. In these views, you can add or move fields to different areas of the views to change the layout or presentation of data. You can also sort, filter, and group data displayed in the views.
For more information on PivotTable and PivotChart views of a form, see the topic About designing a PivotTable or PivotChart view.
More information about forms
Would you like to look at some sample forms before you create your own? Download the Sample Forms Database from Office Online. This database contains several working samples of forms, plus help that explains how to create that form.
If you're new to forms, the links in this section take you to basic information on creating and using forms, dialog boxes, and switchboards.
The basics of creating and using forms
After you create a form, you can customize it many ways. The next few sections provide links to information about how to modify and enhance your forms.
You can customize the appearance and functionality of forms in Design view. For example, you can set the font and color settings of the text displayed on a form, or change the size and position of the form window.
For more information, see the following topics:
Publish a form to the Web
If you want to make your form available to users over the Internet or an intranet, save the form as a data access page, and then publish that page. You can also use this technique when you want to distribute your form to users who do not have Access installed on their computer.
For more information about saving forms as data access pages, see Save a database object as another object type. For more information about publishing data access pages, see Publish Web pages.
Print a form
Use a form to filter a query or report
Add calculations to a form
In addition to displaying data that is stored in underlying tables, queries, and constant values, a control on a form can also display calculated values. You enter a formula or an expression as the control's source in Design view, and Access displays the calculated value in Form or Datasheet view. You can calculate detail and aggregate values.
For more information, see the topic Create an expression.
Write code to extend the functionality of a form and its controls
If you want to add custom functionality to a form, such as disabling or hiding a text box when a user selects a check box, or populating a list box based on what the user types in a combo box, you will need to write Visual Basic® for Applications (VBA) code or create macros.
For more information on writing VBA code or creating macros, see the following topics: