|[ LiB ]|
Storing data is just one task your database performs . You need a means of getting data into and out of those tables, and that's what forms are for (mostly). Good forms are easy to use, and they can present just the data and functions the user needs. In this section, you learn the following about forms:
How to open , create, save, and delete a form
Using forms to enter, modify, and delete data
How to search for and limit data
Most forms are used to enter, delete, and modify data, but you can use forms for much more. In this section, you'll learn how to work with forms.
Open a form.
As with all objects, you can find forms in the Database window. Simply click the Forms shortcut on the Objects bar to display all the forms in the database. To open a form, select it and then click Open, or simply double-click the form.
Create and save a form.
There are several ways to create a new form:
Choose Form from the Insert menu to open the New Form dialog box.
Choose AutoForm or Form from the New Object button's drop-down list to launch a wizard to help you build the form.
Click the Forms shortcut on the Objects bar and then double-click one of the shortcut options for opening a new form in design view or launching a form wizard.
Click the Forms shortcut on the Objects bar and then click New to open the New Form dialog box.
When you launch a wizard, simply answer all the questions and let Access do the work. You might have to tweak the results a bit, but a wizard is a quick way to get a form up and running. The wizard creates what's known as a bound form, which means there's a dynamic link to the underlying table. When you enter, modify, or delete data in a bound form (or control), those changes are also made at the table level.
To create a form from scratch, use one of the preceding methods to open the form in design view and start adding controls. These forms can be bound or unbound , depending upon your needs.
Use a form to enter, modify, delete records.
The simple data entry form shown in Figure 6.14 has three main functions: entering new orders and modifying and deleting existing orders. To enter a new record, click the New Record button on the Navigation toolbar to display a set of blank controls (the new record). Using the Tab key, cycle through the controls and enter data as required. When you enter the last value and press Tab, Access saves the record and displays another set of blank controls so you can enter the next new record.
You can also modify existing data. Use the Tab key or simply click a control to access a value. To save the change, move to another control or record. To delete the entire record, press the Delete key or click the Delete Record button on the view toolbar. When Access prompts you, either confirm or cancel the action.
Go to next record, previous record, first record, last record, specific record using form display.
A form has the capacity to display many records in different ways. A continuous form displays a number of records at the same time. Most forms display one record at a time. Use the Navigation buttons on the Navigation toolbar to browse records until you find the appropriate record (refer to Figure 6.14). Or choose Go To from the Edit menu and specify First, Previous, Next, or Last from the resulting menu. Alternately, you can enter the record number in the current record control in the Navigation toolbar and press Enter to view a specific record.
Add, modify text in headers, footers in a form.
Forms can display header and footer elements the same as a word processing document can, but by default, the headers and footers aren't enabled. To open a form's header or footer, open the form in design view. Then, choose Form Header/Footer from the View menu. Doing so opens a section at the top and the bottom of the form, as shown in Figure 6.15. Once the section is open, you simply insert controls as you normally would. For example, to add text to a header, drag a Label control to the header and then add the text to the Caption property of the label. To modify the text, edit the Caption property of the label. Headers and footers are usually used for text that you want to display with every record, such as titles or instructions.
Delete a form.
You can quickly delete an obsolete form. In the Database window, click the Forms shortcut on the Objects bar, select the form in question and press Delete. When prompted, either confirm or cancel the action.
Save and close a form.
To save a form, click Save from the File menu, enter a name , and click OK. Or close a form by clicking the form's Close button (in the title bar). If there are any unsaved changes, Access prompts you to save them.
As just mentioned, you can click the form's Close button in the title bar to close it. Or choose Close from the File menu. (Remember, Exit closes Access, not just the current object.)
|[ LiB ]|