IT tutorials
 
Office
 

Microsoft Access 2010 : Maintain Data Integrity (part 5) - Restricting Data to Values in Lists

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Product Key Free : Microsoft Office 2019 – Serial Number
4/27/2013 9:21:32 PM

5. Restricting Data to Values in Lists

It is interesting how many different ways people can come up with to enter the same items of information in a database. Asked to enter the name of their home state, for example, residents of the state of Washington will type Washington, Wash, or WA, plus various typographical errors and misspellings.

Minor inconsistencies in the way data is entered might not be really important to someone who later reads the information and makes decisions. For example, Arizona and AZ refer to the same state. But a computer is very literal, and if you tell it to create a list so that you can send catalogs to everyone living in AZ, the computer won’t include anyone whose state is listed in the database as Arizona.

You can limit the options for entering information in a database in several ways:

  • If one entry is more likely than any other, you can set the Default Value property of the field to that entry. Users can then press Tab to skip over that field, leaving the default entry intact. Even if users enter something else, the format of the default entry might guide them when choosing their entry’s format.

  • For only two options, you can use a Yes/No field represented by a check box. A check in the box indicates one choice, and no check indicates the other choice.

  • For a short list of choices that won’t change often, you can use a combo box. Clicking the arrow at the right end of the combo box displays the list of choices, which you provide as a lookup list. Depending on the properties associated with the combo box, database users might be able to type something else or they might be able to add entries to the lookup list displayed in the future. Although you can create a lookup list by hand, it is a lot easier to use the Lookup wizard.

Tip

Access comes with three Quick Start lookup lists that are commonly used in businesses: Payment Type, Priority, and Status. You can efficiently add one of these ready-made lookup lists to a table by clicking the More Fields button in the Add & Delete group on the Fields contextual tab, and then clicking the field you want.

In this exercise, you’ll use the Lookup wizard to create a list of states and provinces from which users can choose.

Set Up

You need the GardenCompany06 database you worked with in the preceding exercise to complete this exercise. Open the GardenCompany06 database, and display the FieldTest table in Datasheet view. Then follow the steps.

  1. At the right end of the table, click the Click to Add field. On the Fields contextual tab, in the Add & Delete group, click the More Fields button, and then click Lookup & Relationship.

    image with no caption

    The Lookup wizard starts.

    Set Up

    The first page of the Lookup wizard.

    If a field has a lot of potential entries, or if they will change often, you can link them to a table. (You might have to create a table expressly for this purpose.) If a field has only a few possible entries that won’t change, typing the list directly in the wizard is easier.


  2. Click I will type in the values that I want, and then click Next.

  3. Leave the number of columns set to 1, and click in the first cell in the Col1 column.

  4. Enter the following state and province abbreviations, pressing Tab (not Enter) after each one to move to a new row.

    BC

    CA

    ID

    MT

    OR

    WA

  5. Click Next.

    The wizard needs a little more information before it can create the field.

    See Also

    You assign a name to the new field on this page.

  6. Type fLookup as the name of the field, and select the Limit To List check box. Then click Finish.

  7. Save the table, and switch to Design view.

  8. Click anywhere in the fLookup field, and then in the Field Properties area, click the Lookup tab.

    The Lookup page shows the properties that control the lookup list.

    See Also

    You can see the list you typed in the Row Source property.

  9. In the Field Properties area, click the General tab. Then click anywhere in the Default Value property, type WA, and press Enter.

  10. Switch to Datasheet view, clicking Yes to save your changes to the table.

    The entry WA appears in the fLookup field of the new record.

  11. Click in the fLookup field of the first record, and then click the arrow at the right end of the field.

    The list of possible entries for this field appears.

    See Also

    The list reflects the entries you typed on the wizard’s second page.

    Tip

    Clicking the button that appears below the options list opens the Edit List Items dialog box. If you don’t want users to be able to edit the list, you can disable this property, as we do later in this exercise.

  12. Click MT to enter the abbreviation for Montana in the field.

  13. With MT selected, type b.

    Access completes the entry by displaying C.

  14. Click the record below.

    Access converts bC to BC.

  15. Select BC, type Utah, and press Tab. Then when Access tells you that the entry isn’t in the list and asks whether you want to edit the list, click Yes.

  16. When the Edit List Items dialog box opens, click Cancel, and then click BC in the list.

  17. Switch to Design view, and click the Lookup tab.

    The Limit To List property on the Lookup page for the fLookup field is set to Yes, but the Allow Value List Edits property is also set to Yes, meaning that users can change the list.

  18. Click the Allow Value List Edits property, click the arrow that appears, and then click No.

  19. Save the table, return to Datasheet view, type Utah in the fLookup field, and then press Tab.

    Access informs you that the text you entered is not in the list.

    Tip

    Access will not accept your entry.

  20. Click OK to close the message box. Then click BC in the list, and press Tab.

Clean Up

Close the FieldTest table. Retain the GardenCompany06 database for use in the last exercise.

Multicolumn Lookup Lists

If you want people to be able to select a friendly name from a list but you want the database to store a more compact name or number, you can create a two-column lookup list that associates the two types of entries.

To set up a multicolumn lookup list:

  1. Create a new lookup field, and indicate on the first page of the Lookup wizard that you want to type the values.

  2. On the second page, change the Number Of Columns setting to 2, and then enter the data you want Access to store in Col1 and the friendly name in Col2.

  3. On the third page, indicate which column contains the data to be stored in the database.

  4. Assign a name to the field, select the Limit To List check box, and click Finish.

Clicking the field’s arrow will then display a two-column list from which the user can select an entry. The stored value will be displayed in the field.

To display only the friendly name in the list and in the table:

  1. Switch to Design view.

  2. In the Field Properties area, on the Lookup tab, change the Column Widths property from 1”;1? to 0;1?.

  3. Save the table.

 
Others
 
- Microsoft Access 2010 : Maintain Data Integrity (part 4) - Restricting Data by Using Validation Rules
- Microsoft Access 2010 : Maintain Data Integrity (part 3) - Restricting the Format of Data
- Microsoft Access 2010 : Maintain Data Integrity (part 2) - Restricting the Amount of Data
- Microsoft Access 2010 : Maintain Data Integrity (part 1) - Restricting the Type of Data
- Microsoft Project and the Project Management Domain : Using Microsoft Project with Methodologies and Life Cycles
- Microsoft Project and the Project Management Domain : Exploring Project Management Industry Standards
- Microsoft OneNote 2010 : Formatting Text (part 2) - Inserting Symbols and Special Characters, Copying and Applying Formatting with the Format Painter
- Microsoft OneNote 2010 : Formatting Text (part 1) - Setting the Default Font, Changing Basic Text Formatting, Using the Styles Gallery
- Microsoft Visio 2010 : Managing and Styling Pages (part 3) - Controlling Page Size and Orientation, Setting Page Scales
- Microsoft Visio 2010 : Managing and Styling Pages (part 2) - Working with Background Pages, Inserting Backgrounds, Titles, and Borders
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us