Chapter 3
IN THIS CHAPTER
Entering data on a datasheet
Changing the look of a datasheet
Creating a form for entering data
Finding and replacing your data
At last — you can start entering the data. If you set up your database tables, named the fields, and established relationships between the tables, you’re ready to go. This short chapter explains how to enter the data in a database table. It shows you how to enter data on a datasheet or enter data by way of a form. This chapter also describes how to find missing records in case one goes astray.
There’s no getting around it: Entering data is truly a tedious activity. But if you set up the fields well and take advantage of input masks and other field properties, it isn’t so bad. It’s better than stepping on a shovel blade, anyway.
When it comes to entering data in a database table, you can take your pick between Datasheet view and a form. Figure 3-1 compares and contrasts the two. Here are the advantages of entering data in Datasheet view:
Here are the advantages of entering the data in a form:
Entering data in Datasheet view is like entering data in a conventional table. As with a table, a datasheet has columns and rows. Records are entered in rows, and each column represents a field. Fans of Datasheet view like being able to look at a dozen records simultaneously. For fans of Datasheet view, these pages explain how to enter data in a datasheet and change a datasheet’s appearance.
Database tables open in Datasheet view when you double-click their names in the Navigation pane. But if you happen to be gazing at a table in Design view, click the View command on the Home tab or the Datasheet View button on the status bar.
In Datasheet view, the bottom of the window tells you how many records are entered in the database table and which record the cursor is in. To enter a new record, move to a new, empty row and start entering the data. To create a new row, do one of the following:
A pencil icon appears on the row selector to let you know which record you’re dealing with. To get from field to field, click in a field, press the Tab key, or press Enter. Table 3-1 lists keyboard shortcuts for getting around in a datasheet.
TABLE 3-1 Datasheet Shortcuts
Press… |
To Move… |
↑ |
To the previous record. You can also press the Previous button on the Navigation buttons. |
↓ |
To the next record. You can also press the Next button. |
Tab or Enter |
To the next field in the record. |
Shift+Tab |
To the previous field in the record. |
Home |
To the first field in the record. |
End |
To the last field in the record. |
Ctrl+Home |
To the first field in the first record. You can also press the First button. |
Ctrl+End |
To the last field in the last record. You can also press the Last button. |
Page Up |
Up one screen. |
Page Down |
Down one screen. |
To delete a record, click its row selector and press the Delete key or the Delete button (located on the Home tab). You can also click in a record, go to the (Table Tools) Fields tab, and click the Delete button there. After you delete a record, it is gone forever. You can’t resuscitate it.
In a database table with many fields, it’s sometimes hard to tell what data to enter. When the pointer is in the sixth or seventh field, for example, you can lose sight of the first field, the one on the left side of the datasheet that usually identifies the person or item whose record you’re entering.
Another way to handle the problem of not being able to identify where data is supposed to be entered is to hide columns in the datasheet. To perform this trick, select the columns you want to hide by dragging the pointer across their names; then right-click the column heading and choose Hide Fields on the shortcut menu. To see the columns again, right-click any column heading and choose Unhide Fields on the shortcut menu. You see the Unhide Columns dialog box. Select the fields that you want to see on the datasheet.
To make the datasheet a little less cluttered and unwieldy, try experimenting with its appearance. Access offers a few handy shortcuts for doing just that:
Forms like the one shown in Figure 3-3 are very convenient for entering data. The labels tell you exactly what to enter. Personally, I prefer entering data in a form to entering data on a datasheet. On a form, you take it one step — make that one record — at a time. Not looking at a dozen records makes the task of entering data a little easier. These pages explain how to create a form for entering information in a database table. You also get advice for moving around with the Navigation buttons.
Fortunately, the Form Wizard makes it very simple to create a form for entering information in a database table. All you have to do is start the wizard, choose the table, and make a couple of design decisions. To create a form, go to the Create tab and click the Form Wizard button. You see the first of several Form Wizard dialog boxes. Answer these questions and keep clicking the Next button until the time comes to click Finish:
To delete a form, right-click its name in the Navigation pane and choose Delete on the shortcut menu.
To open a form and begin entering data in its database table, display the form’s name in the Navigation pane and then double-click the form’s name. You can also right-click the name of the form and choose Open.
The Navigation buttons at the bottom of the form window tell you how many records are in the database table and which record you’re looking at. From left to right, the Navigation buttons take you to the first record, previous record, next record, and last record.
Sometimes data goes astray. You scroll through a datasheet but simply can’t find the item or record you need so badly. For times like those, Access offers the Find command. Use the command to scour a database for errant information.
Open the database table with the data that needs finding. If you know in which field the data is located, click in the field. You can save a little time that way. Then, on the Home tab, click the Find button (or press Ctrl+F). You see the Find and Replace dialog box, as shown in Figure 3-4. Fill in the dialog box as follows:
TABLE 3-2 Wildcard Characters for Searches
Character |
Description |
Example |
? |
A single character |
b?t finds bat, bet, bit, and but. |
# |
A single numeric digit |
9411# finds 94111, 94112, 94113, and so on. |
* |
Any group of consecutive characters |
t*o finds to, two, and tattoo. |
[xyz] |
Any character in the brackets |
t[aio]pper finds tapper, tipper, and topper, but not tupper. |
[!xy] |
Any character not in the brackets |
p[!io]t finds pat and pet, but not pit and pot. |
x–z |
Any character in a range of characters |
[1–4]000 finds 1000, 2000, 3000, and 4000, but not 5000. The range must be in ascending order. |
Click the Find Next button to conduct the search. The item might be found in more than one location. Keep clicking Find Next (or pressing Alt+F) until you find the item or you die of thirst on the hot sands of the digital desert.
Finding and replacing data is remarkably similar to finding data. The difference is that you enter data in the Replace With text box as well as the familiar Find What text box and other option boxes. Figure 3-5 shows the Replace tab of the Find and Replace dialog box. Does it look familiar? If it doesn’t, read the preceding topic in this chapter, “Finding a Missing Record.”
To find and replace data, go to the Home tab and click the Replace button (or press Ctrl+H). You see the Replace tab of the Find and Replace dialog box. After you enter the replacement data in the Replace With text box, make sure that Whole Field is selected in the Match drop-down list. Conducting a find-and-replace operation with Any Part of Field or Start of Field selected in the Match drop-down list can have unintended consequences. For example, a search for Brook also finds Brooklyn, Middlebrook, and other words that include brook. Blindly replacing the brook text string with stream produces, for example, Streamlyn and Middlestream.
By the way, you can also find and replace data with an update query. Chapter 4 of this minibook covers update queries.