Home > Articles > Data > Access

Designing Microsoft Access 2007 Forms for Efficient and Accurate Data Entry

Paul McFedries 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).
This chapter is from the book

In This Chapter

Preventing Errors by Validating Data

50

Using Controls to Limit Data Entry Choices

55

Case Study: Using an Option Group to Select the Shipper

61

Entering Data with ActiveX Controls

67

Collecting Form Data via Email

72

From Here

75

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:

  • Data that is the wrong type. For example, entering a text string in a cell that requires a number.
  • Data that falls outside an allowable range. For example, entering 200 in a cell that requires a number between 1 and 100.

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:

  • Add status bar text. This is a string that appears in the Access status bar when users enter the field. You specify this text by opening the field's property sheet, displaying the Other tab, and then entering the string in the Status Bar Text property.
  • Add a label. Place a Label control near the field and use it to enter text that describes the field's data requirements or shortcut keys. For example, if the field requires a date, the label might say Press Ctrl+; to enter today's date.

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.

Figure 3.1

Figure 3.1 Use form labels and status bar text to give the users text prompts about the data they must enter.

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:

  1. Display the property sheet of the field to which you want to apply the data validation rule.
  2. Click the Data tab.
  3. Click inside the Validation Rule property.
  4. Enter a formula that specifies the validation criteria. You can either enter the formula directly into the property box, or you can click the ellipsis (...) button and enter the formula using the Expression Builder.
  5. If you want a dialog box to appear when the users enter invalid data, click inside the Validation Text property and then specify the message that appears.
  6. Close the property sheet to apply the 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

Figure 3.2 Use the Validation Rule property to enter a data validation expression for a field.

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.

Figure 3.3

Figure 3.3 If the users enter invalid data in the field, Access displays a dialog box such as this one, which uses the string entered into the Validation Text property.

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:

  1. Display the property sheet of the field to which you want to apply the input data.
  2. Click the Data tab.
  3. Click inside the Input Mask property.
  4. Click the ellipsis (...) button to start the Input Mask Wizard, shown in Figure 3.4.
    Figure 3.4

    Figure 3.4 Use the Input Mask Wizard to choose a predefined input mask or to create your own input mask.

  5. In the Input Mask list, click the input mask you want (or that's close to what you want) and then click Next.
  6. Use the Input Mask box to make changes to the mask (see "Creating a Custom Input Mask Expression," next, for the specifics of which symbols to use); use the Placeholder Character list to choose the character you want to appear in the input mask as a placeholder; click Next.
  7. Click the option that matches how you want the field data stored in the table (click Next after you've made your choice):
    • With the Symbols in the Mask—Click this option if you want the extra symbols (such as the parentheses and dash in a phone number mask) stored along with the data.
    • Without the Symbols in the Mask—Click this option to store only the data.
  8. Click Finish.

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:

  • Data placeholders—These characters are replaced by the actual data typed by the users. The different placeholders specify the type of character the users must enter (such as a digit or letter) and whether the character is optional or required.
  • Modifiers—These characters aren't displayed in the mask; instead, they're used to modify the mask in some way (such as converting all the entered characters to lowercase).
  • Literals—These extra characters appear in the mask the same as you enter them in the expression. For example, you might use parentheses as literals to surround the area code portion of a phone number.

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

Placeholder

Data Type

Description

0

Digit (0–3)

The character is required; the users are not allowed to include a plus sign (+) or minus sign (-).

3

Digit or space

The character is optional; the users are not allowed to include a plus sign (+) or minus sign (-).

#

Digit or space

The character is optional; the users are allowed to include a plus sign (+) or minus sign (-).

L

Letter (az or AZ)

The character is required.

?

Letter (az or AZ)

The character is optional.

a

Letter or digit

The character is required.

A

Letter or digit

The character is optional.

&

Any character or space

The character is required.

C

Any character or space

The character is optional.

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

Modifier

Description

\

Displays the following character as a literal; for example, \( is displayed as (.

"text"

Displays the string text as a literal; for example, "MB" is displayed as MB.

.

Decimal separator.

,

Thousands separator.

: ; - /

Date and time separators.

<

Displays all the following letters as lowercase.

>

Displays all the following letters as uppercase.

!

Displays the input mask from right to left when you have optional data placeholders on the left.

Password

Displays the characters as asterisks so that other people can't read the data.

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:

>aaaa\-0000

Note, too, that input masks can contain up to three sections separated by semicolons (;):

first;second;third

  • first—This section holds the input mask expression.
  • second—This 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.
  • third—This 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:

00000\-3333;0;.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020