Designing Forms for Efficient and Accurate Data Entry
June 5, 2007
Microsoft® Office Access 2007 Forms, Reports, and Queries
May 2007, Paperback, 408 pages
Publisher: Pearson Education
Buy this book
This excerpt from "Microsoft Office Access 2007 Forms, Reports, and Queries" introduces several techniques that serve to either make data entry less of a chore, or to reduce or eliminate data entry errors (or both).
Chapter 3: Designing Forms for Efficient and Accurate Data Entry
In this chapter
Data entry is one of those tasks that I describe as "dangerous" because it's a chore that's both tedious and important. It's tedious because entering dozens or hundreds of records is no one's idea of fun. It's important because the data must be entered accurately; otherwise, any analysis of the data becomes at best misleading and at worst just plain wrong. The danger, then, lies in the fact that data entry is prone to errors but can't afford to have any.
As a forms designer, you can help to reduce this danger by setting up your forms so that data entry is both as efficient as possible and as accurate as possible. In some cases you can achieve both goals with a single technique. For example, asking someone to type a customer name manually is both slow and prone to misspellings. However, suppose you already have a Customers table with a CustomerName field. If you relate the current table with the Customers table (using, say, a common CustomerID field), Access adds the CustomerName field to the current form using a drop-down list that contains all the customers. This makes data entry more efficient (the users just select a name from the list instead of typing it) and more accurate (the users can't misspell the customer name).
This chapter introduces you to several techniques that serve to either make data entry less of a chore, or to reduce or eliminate data entry errors (or both).
Preventing Errors by Validating Data
If, as the cooks say, a recipe is only as good as its ingredients, a database is only as good as its data. Viewing, summarizing, and analyzing the data are meaningless if the table you're working with contains erroneous or improper data. For basic data errors (for example, entering the wrong date or transposing a number's digits), there's not a lot you can do other than exhorting yourself or the people who use your forms to enter data carefully. Fortunately, you have a bit more control when it comes to preventing improper data entry. By "improper," I mean data that falls in either of the following categories:
The next few sections show you several techniques that can help you reduce these types of errors.
Helping Users with Text Prompts
You can prevent improper entries to a certain extent by adding text that provides details on what is allowable inside a particular cell. You have two choices:
For example, Figure 3.1 shows the Mortgage Calculator form. Notice the labels added beside the Interest Rate and Term text boxes that specify to the users that they must enter the interest rate per annum and the term in years. Note, too, the status bar text that appears when the users enter the Interest Rate field.
Preventing Errors with Data Validation Expressions
The problem with text prompts is they require other people to both read and act on the text. The better solution for preventing data entry errors is the Access data validation feature. With data validation, you create rules that specify exactly what kind of data can be entered and in what range that data can fall. You can also specify pop-up input messages that appear when a cell is selected, as well as error messages that appear when data is entered improperly.
Follow these steps to define the settings for a data validation rule:
For example, suppose you want the users to enter an interest rate. This quantity should be positive, of course, but it should also be less than 1. (That is, you want users to enter 6% as 0.06 instead of 6.) Figure 3.2 shows the property sheet for a field named InterestRate that meets these criteria by defining the following expression in the Validation Rule property:
>0 And <1
Figure 3.2 also shows a string in the Validation Text property. If the users enter invalid data (that is, any value for which the Validation Rule expression returns False), the Validation Text appears in a dialog box, as shown in Figure 3.3.
Using Input Masks for Consistent and Accurate Data Entry
One of the major headaches that database administrators have to deal with is data entered in an inconsistent way. For example, consider the following phone numbers:
(123)555-6783 (123) 555-6783 (123)5556783 123555-6783 1235556783
These sorts of inconsistencies might appear trivial, but they can cause all kinds of problems, from other users misreading the data to improper sorting to difficulties analyzing or querying the data. And it isn't just phone numbers that cause these kinds of problems. You also see them with Social Security numbers, ZIP codes, dates, times, account numbers, and more.
One way to avoid such inconsistencies is to add a label or status bar message that specifies the correct format to use. As with data validation, however, these prompts are not guaranteed to work every time (or even most of the time).
A better solution is to apply an input mask to the field. An input mask is a kind of template that shows the users how to enter the data and prevents them from entering incorrect characters (such as a letter where a number is required). For example, here's an input mask for a phone number:
Each underscore (_) acts as a placeholder for (in this case) a digit, and the parentheses and dash appear automatically as the user enters the number.
Using the Input Mask Wizard
The easiest way to create an input mask is to use the Input Mask Wizard. Here are the steps to follow:
Creating a Custom Input Mask Expression
If your data doesn't fit any of the predefined input masks, you need to create a custom mask that suits your needs. You do this by creating an expression that consists of three kinds of characters:
Table 3.1 lists the data placeholders you can use to build your input mask expressions.
Table 3.1 Data Placeholders to Use for Custom Input Masks
Table 3.2 lists the modifiers and literals you can use to build your input mask expressions.
Table 3.2 Modifiers and Literals to Use for Custom Input Masks
You can enter your input mask expressions directly into the Input Mask property, or you can modify a predefined input mask using the Input Mask Wizard.
For example, suppose your company uses account numbers that consist of four uppercase letters and four digits, with a dash (-) in between. Here's an input mask suitable for entering such numbers:
Note, too, that input masks can contain up to three sections separated by semicolons (;):
firstThis section holds the input mask expression.
secondThis optional section specifies whether Access stores the literals in the table when you enter data. Use 0 to include the literals; use 1 (or nothing) to store only the data.
thirdThis optional section specifies the placeholder character. The default is the underscore (_).
For example, here's an input mask for a ZIP code that stores the dash separator and displays dots (.) as placeholders: