Jump to content

How to Update Database Records with Forms in Access 2010

0
  chco's Photo
Posted Aug 31 2010 10:49 PM

The following is companion content for Office 2010: The Missing Manual. It shows you how to update use forms in Access 2010 to find, edit, create, delete, and print database records.
Upon creating a form, it’s time to take it for a test spin. For that you need to leave behind Layout view and switch over to Form view.

Note: When you open a form by double-clicking it in the navigation pane, it opens in Form view. If you don’t want this view, then right-click your form in the navigation pane, and choose Layout View or Design View to start out in a different view.

To try out the form, switch it to Form view if you’re not already there. Just right-click the tab title, and choose Form View.

In Form view, you can perform all the same tasks you performed in the datasheet when you worked with a table. With a simple form, the key difference is that you see only one record at a time.

Most people find forms much more intuitive than the datasheet grid. The following sections give a quick overview of how you can use Form view to perform some common tasks.

Finding and Editing a Record

Rare is the record that never changes. Depending on the type of data you’re storing, most of your work in Form view may consist of hunting down a specific record and making modifications. You may need to ratchet up the price of a product, change the address details of an itinerant customer, or reschedule a class.

Before you can make any of these changes, you need to find the right record. In Form view, you have four ways to get to the record you need. The first three of these methods use the navigation controls that appear at the bottom of the form window.

  • By navigating. If your table is relatively small, then the fastest way to get going is to click the arrow buttons to move from one record to the next. Page 768 has a button-by-button breakdown.

  • By position. If you know exactly where your record is, then you can type in the number that represents the position (for example, 100 for the 100th record), and then press Enter. If you don’t get exactly where you want, then you can also use the navigation buttons to move to a nearby record.

  • By searching. The quick search feature finds a record with a specific piece of text (or numeric value) in one of its fields. To use quick search, type the text you want to find in the search box, as shown in Figure E-7. If you want a search that examines a specific field or gives you additional options, then use the Home➝Find➝Find command, which is described on page 776.

  • By filtering. Using filtering, you can narrow down the displayed records to a small set. Filtering’s best-kept secret is that you can use a feature called filter by form to quickly hunt down a single record. You saw how that worked on page 771.


Once you’ve found the record you want to change, you can edit it in the same way you would in the datasheet. If you make a change that breaks a rule (like typing the text Exasperated Bananas in a date field), then you get the familiar error messages.

Access commits any change you make as soon as you move to another record or field. To back out of a change, press Esc before you move on. When you do, the original value reappears in the cell, and Access tosses out your changes. And if you do commit a change by accident, then you can use the Undo button in the Quick Access toolbar (above the ribbon), or press Ctrl+Z, to reverse it.

Attached Image

Adding a Record

As you already know, you add a new record in Datasheet view by scrolling to the very bottom of the table, and typing just underneath the last row. In Form view, the concept is similar—scroll to the very end of your table, just past the last record.

You’ll know you’ve reached the magic ready-to-add-a-record spot when all the fields in your form are blank (Figure E-8). To save yourself the scrolling trip, use the New Record button at the bottom of the form.

If you’ve decided that you don’t want to add a new record after all, then press Esc twice. The first time you press Esc, Access wipes out the value in the current field.

The second time, Access removes all the other values you entered. Now that your form has been restored to its original emptiness, you can safely scroll off to another record.

If you scroll away from your new record while there’s still some data left in it, then Access creates the new record and adds it to the table. You can’t reverse this action. If you want to get rid of a newly created record, then you need to delete it, as described in the next section.

Attached Image

Deleting a Record

When you find a record that shouldn’t exist, you can wipe it out in seconds. The easiest way to delete the current record is to choose Home➝Records➝Delete. But you have another option. You can select the whole record by clicking the margin on the form window’s left side. Then you can liquidate it by pressing Delete.

No matter what approach you use, Access asks you for confirmation before it removes a record. You can’t recover deleted records, so tread carefully.

Printing Records

Here’s a little-known secret about forms: You can use them to create a quick printout. To do so, open your form, and then choose File➝Print➝Print. The familiar Print dialog box appears, where you can choose your printer and the number of copies you want.

When you print a form, Access prints all the records, one after the other. If you want to print just the current record, then, in the Print dialog box, choose the Selected Records option before you click OK.

You can also use File➝Print➝Print Preview to check out the result before you send it to the printer (Figure E-9). Click Print Preview➝Close Preview➝Close Print Preview to return to your form.

Attached Image

Although you might be tempted to use forms as a convenient way to create snazzy printouts, you’ll always get more features and better control if you use reports.

Office 2010: The Missing Manual

Learn more about this topic from Office 2010: The Missing Manual.

Whether you're new to Microsoft Office or have used it for years, this clear and friendly primer helps you be productive with Word, Outlook, Excel, PowerPoint, Access, and the rest of the Office apps from day one. Learn what's new in Office 2010 and get a complete, step-by-step guide to each of its main programs, along with details on Publisher, OneNote, and Office Web Apps. With this Missing Manual on hand, you'll be creating professional-quality documents, spreadsheets, presentations, and databases in no time.

See what you'll learn


1 Reply

0
  Jacob999's Photo
Posted Mar 30 2012 11:46 PM

Yikes! Please check this out: "Access commits any change you make as soon as you move to another record or field." Access 2003 did; however, Access 2010 DOES NOT commit any change you make as soon as you move to another FIELD! Changes only appear to be committed when the form focus moves to another record!!!! --- I am astounded! Can you recommend a way of changing this behavior in Access 2010 to: "Access commits any change you make as soon as you move to another record or field."???

Many Thanks, Jacob