IT tutorials
 
Office
 

Microsoft Access 2010 : Maintain Data Integrity (part 1) - Restricting the Type of Data

- 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:13:17 PM

1. Restricting the Type of Data

For example, if the data type is set to Number and you try to enter text, Access refuses the entry and displays a warning.

When setting the data type of a field in a table in Design view, you can choose from the following types:

  • Text . Use for text fields that require up to 255 alphanumeric characters.

  • Memo . Use for text fields that require up to 65,535 alphanumeric characters.

  • Number . Use for numeric values. The size of the entry is controlled by the Field Size property.

  • Date/Time . Use for dates from January 2, 100 through December 31, 9999. Dates and times can be expressed in a variety of formats.

  • Currency . Use for decimal values with up to 15 digits to the left of the decimal point and up to 4 digits to the right.

  • AutoNumber . Use when you want Access to assign a unique number to each new record. If you delete a record, its AutoNumber value is not reused, and remaining records are not updated.

  • Yes/No . Use for fields that can have only two possible mutually exclusive values, such as True or False.

    Tip

    In the database world, the Yes/No data type is more commonly called Boolean, in honor of George Boole, an early mathematician and logistician.

  • OLE Object . Use to hold a graphic or other object. The object can be linked or embedded.

  • Hyperlink . Use to hold a clickable path to a folder on your hard disk, a network location, or a Web site.

  • Attachment . Use to attach a file to a record in the same way that you might attach a file to an e-mail message.

    Tip

    The Attachment data type can be assigned to a field only when the field is first created. You can’t assign the Attachment type to an existing field, nor can you change an Attachment field to another data type. For information about the Attachment data type, search for Attach files and graphics to the records in your database in Access Help.

  • Calculated . Use to hold the results of a calculation based on other fields in the same table.

When adding a field in Datasheet view, you can choose what seems to be an additional data type:

  • Rich Text . Use for text fields that require up to 65,535 alphanumeric characters with character formatting.

This is actually the Memo data type with the Text Format property set to Rich Text instead of Plain Text.

You can also click the More Fields button in the Add & Delete group on the Fields contextual tab to display a gallery of data types with predefined properties that produce fields with common data type refinements.

In this exercise, you’ll use various methods to add fields of the most common data types to a table. Then you’ll enter data to test the data type restrictions.

Set Up

You need the GardenCompany06_start database located in your Chapter06 practice file folder to complete this exercise. Open the GardenCompany06_start database, and save it as GardenCompany06. Then follow the steps.

  1. On the Create tab, in the Tables group, click the Table button.

    Access opens a new blank table. As is normal with new tables, Access has automatically generated an ID field that has been assigned the AutoNumber data type.

    image with no caption
  2. On the Fields contextual tab, in the Add & Delete group, click the Text button. Then change the selected field name to fText.

    image with no caption

    If you use the name of a data type as the name of a field, Access warns you that the name might cause problems. We will identify all the fields in this table by their data type, preceded by the letter f.

  3. Display the Click to Add list, click Currency, and then change the field name to fMoney.

  4. In the Add & Delete group, click the More Fields button.

    image with no caption

    A gallery of data types, some with refinements, appears.

    Set Up

    Clicking an option in the list sets the data type and any predefined property settings.

  5. In the gallery, under Number, click Standard. Then change the field name to fNumber.

  6. Display the More Fields gallery, click Medium Date under Date and Time, and change the field name to fDate. Then display the gallery again, click Check Box under Yes/No, and name the field fBoolean.

    The table now has six fields.

    Set Up

    Clicking the check box in the fBoolean field will indicate a Yes or True entry.

  7. Save the table with the name FieldTest, and then switch to Design view.

    Keyboard Shortcut

    Press Ctrl+S to display the Save As dialog box.

  8. In turn, click each field in the list at the top of the design page, noticing the setting in the Data Type column and the property settings in the Field Properties area.

    Only the properties that you can set for each type of field are displayed. For the fNumber, fMoney, and fDate fields, the Format property reflects the choice you made when creating the field.

  9. Switch back to Datasheet view. Then in the fText cell, type This entry is 32 characters long.

  10. In the fMoney field, type the word currency, and press Tab.

    Access tells you that it cannot accept the unexpected type of data.

    See Also

    Options for correcting the erroneous entry.

  11. In the list, click Enter new value. Then type –45.3456, and press Tab.

    Access stores the number the way you entered it but displays ($45.35), the default format for negative currency numbers.

    Tip

    Access uses the region and language settings in Windows Control Panel to determine the display format for date, time, currency, and other numbers. So although the numbers won’t change, your currency symbol might be different; for example, Access might display the pound, peso, or euro symbol. If you want the symbol to remain the same no matter what the region and language settings, you can create a custom format to ensure that currency values always display a specific symbol. 

  12. In the fNumber cell, type Five hundred, and then press Tab.

    Again, Access tells you that it cannot accept this type of entry in this field.

  13. In the list of options, click Enter new value, type 500, and press Tab.

  14. In the fDate cell, type 123456, and press Tab. When Access prompts for the correct type of entry, click Enter new value, click the Calendar button to the right of the field, and click Today to insert today’s date. Then press Tab.

    image with no caption

    All Date/Time fields come with an associated interactive calendar. Using the Calendar button to insert a date works well if the date you want is close to the current date. (You can click the arrows at either end of the title bar to display the previous or next month.) However, for distant dates such as birthdates, it is easier to ignore the Calendar button and type the date. Access accepts almost any entry that can be recognized as a date and displays it in the format you specified when you created the field.

    Tip

    If you enter a month and day but no year in a date field, Access assumes the date is in the current year. If you enter a month, day, and two-digit year from 00 through 29, Access assumes the year is 2000 through 2029. If you enter a two-digit year that is greater than 29, Access assumes you mean 1930 through 1999.

  15. In the fBoolean field, try to enter abc and 123. Then click several times anywhere in the field to toggle the check box between the checked and not checked states, finishing with the field in the checked state.

    This field won’t accept anything you type; you can only switch between two predefined values.

    Tip

    The table, with the correct type of data in each field.

    Tip

    The stored value of a Yes/No field is always either 1 (Yes) or 0 (No). On the General page of the Field Properties area in Design view, you can set the Format property of the field to interpret the stored value as True/False, Yes/No, or On/Off. On the Lookup page, you can set the field to display as a check box, text box, or combo box. (In a combo box, you can select from a list or type an entry.)

Clean Up

Save the FieldTest table, and then close it. Retain the GardenCompany06 database for use in later exercises.

 
Others
 
- 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
- Microsoft Visio 2010 : Managing and Styling Pages (part 1) - Inserting Pages
- Microsoft PowerPoint 2010 : Incorporating Motion Video - Specifying Playback Options
- Microsoft PowerPoint 2010 : Managing Videos Between PCs and PowerPoint Versions, Changing the Video's Formatting
- Microsoft Excel 2010 : Macros and UDFs - User-Defined Functions
 
 
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