IT tutorials
 
Office
 

Microsoft Access 2010 : Creating Your Own Databases and Tables - Working with Field Properties (part 3)

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Product Key Free : Microsoft Office 2019 – Serial Number
3/23/2014 1:34:35 AM

The Default Value Property: Saving Data-Entry Time

Assigning a Default Value property to a field causes a specified value to be filled in for the field in new records. Setting a commonly used value as the Default Value property facilitates the data entry process. When adding data, you can accept the default entry or replace it with another value. For example, if most of your customers are in California, you can assign a default value of ”CA”. When doing data entry, if the customer is in California you will not need to change the value for the state. If the customer is in another state, you just replace the ”CA” with the appropriate state value.

Set the Default Value Property from Design View

To set a Default Value property (from Design view), follow these steps:

1.
Select the desired field from the top pane of the Design view window.

2.
Click the Default Value property text box in the Field Properties pane.

3.
Type the desired value.

A Default Value property can be constant, such as CA for California, or a function that returns a value, such as Date(), which displays the current date.


The data users enter in tables must be accurate if the database is to be valuable to you or your organization. You can use the Validation Rule property to add data entry rules to the fields in tables.

Date() is a built-in Visual Basic for Applications (VBA) function that returns the current date and time. When it is used as a default value for a field, Access enters the current date into the field when the user adds a new row to the table.


The Validation Rule and Validation Text Properties: Controlling What the User Enters in a Field

The Default Value property suggests a value to the user, but the Validation Rule property actually limits what the user can place in the field. Validation rules cannot be violated; the database engine strictly enforces them. As with the Default Value property, this property can contain either text or a valid Access expression, but you cannot include user-defined functions in the Validation Rule property. You also cannot include references to forms, queries, or tables in the Validation Rule property.

You can use operators to compare two values; the less than (<) and greater than (>) symbols are examples of comparison operators. And, Or, Is, Not, Between, and Like are called logical operators. Table 2 provides a few examples of validation rules.

Table 2. Examples of Validation Rules
Validation RuleValidation Text Examples
>0Please enter a valid Employee ID Number.
“H” or “S” or “Q”Only H or S or Q codes will be accepted.
Between Date()-365 and Date()+365Date cannot be later than one year ago today or more than one year from today.
>0 or is NullEnter a valid ID number or leave blank if not approved.
Between 0 and 9 or is NullRating range is 0 through 9 or is blank.
>Date()Date must be after today.

Whereas the validation rule limits what the user can enter into the table, the validation text provides the error message that appears when the user violates the validation rule.

If you set the Validation Rule property but do not set the Validation Text property, Access automatically displays a standard error message whenever the user violates the validation rule. To display a custom message, you must enter message text in the Validation Text property.


Set the Validation Rule Property from Design View

To establish a field-level validation rule (from Design view), follow these steps:

1.
Select the desired field name from the top pane of the Design view window.

2.
Click the Validation Rule text box in the Field Properties pane.

3.
Type the desired validation rule (for example, Between 0 and 120).

Set the Validation Text Property from Design View

To add validation text, follow these steps:

1.
Click the Validation Text text box in the Field Properties pane.

2.
Type the desired text (for example, Age Must be Between 0 and 120).

You can require users of a database to enter a valid value in selected fields when editing or adding records. For example, you can require a user to enter a date for each record in an Invoice table.

 
Others
 
- Microsoft Access 2010 : Creating Your Own Databases and Tables - Working with Field Properties (part 2)
- Microsoft Access 2010 : Creating Your Own Databases and Tables - Working with Field Properties (part 1)
- Microsoft Access 2010 : Creating Your Own Databases and Tables - Using Indexes to Improve Performance
- Microsoft Access 2010 : Creating Your Own Databases and Tables - Selecting the Appropriate Field Type for Data
- Microsoft Access 2010 : Creating Your Own Databases and Tables - Building a New Table (part 2) - Designing a Table from Scratch
- Microsoft Access 2010 : Creating Your Own Databases and Tables - Building a New Table (part 1) - Building a Table from a Datasheet
- Microsoft Access 2010 : Creating Your Own Databases and Tables - Types of Databases Available, Creating a New Database
- Taking Microsoft Project 2010 for a Test Drive (part 7) - How Long Will All These Tasks Take?
- Taking Microsoft Project 2010 for a Test Drive (part 6) - List the people on your project,Assign resources to tasks
- Taking Microsoft Project 2010 for a Test Drive (part 5) - Creating task dependencies
 
 
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