If you’ve worked through this book to this point, you should understand all the mechanics of designing and building databases (and connecting to external ones), entering and viewing data in tables, and building queries. An understanding of tables and queries is important before you jump into forms because most of the forms you design will be bound to an underlying table or a query.
This chapter focuses on the external aspects of forms-why forms are useful, what they look like, and how to use them. You’ll look at examples of forms from the Conrad Systems Contacts sample database. In Chapters 11, 12 and 13, you’ll learn how to design, build, and customize your own forms by learning to build some of the forms you see in the Conrad Systems Contacts and Housing Reservations databases.
Forms are the primary interface between users and your Microsoft Office Access 2007 application. You can design forms for many different purposes.
Displaying and editing data This is the most common use of forms. Forms provide a way to customize the presentation of the data in your database. You can also use forms to change or delete data in your database or add data to it. You can set options in a form to make all or part of your data read-only, to fill in related information from other tables automatically, to calculate the values to be displayed, or to show or hide data on the basis of either the values of other data in the record or the options selected by the user of the form.
Controlling application flow You can design forms that work with macros or with Microsoft Visual Basic procedures to automate the display of certain data or the sequence of certain actions. You can create special controls on your form, called command buttons, which run a macro or a Visual Basic procedure when you click them. With macros and Visual Basic procedures, you can open other forms, run queries, restrict the data that is displayed, execute a Ribbon command, set values in records and forms, display customized Ribbons, print reports, and perform a host of other actions. You can also design a form so that macros or Visual Basic procedures run when specific events occur-for example, when someone opens the form, tabs to a specific control, clicks an option on the form, or changes data in the form. See Part 4, “Automating an Access Application,” for details about using macros and Visual Basic with forms to automate your application.
Accepting input You can design forms that are used only for entering new data in your database or for providing data values to help automate your application.
Displaying messages Forms can provide information about how to use your application or about upcoming actions. Office Access 2007 also provides a MsgBox macro action and a MsgBox Visual Basic function that you can use to display information, warnings, or error messages. See Chapter 20, “Automating Your Application with Visual Basic,” for more detail.
Printing information Although you should design and use reports to print most information, you can also print the information displayed in a form. Because you can specify one set of options when Access displays a form and another set of options when Access prints a form, a form can serve a dual role. For example, you might design a form with two sets of display headers and footers, one set for entering an order and another set for printing a customer invoice from the order.