A data type represents the kind of information that a
particular field should, would, or must hold. Every field in your database
objects (tables, forms, and reports) should have the right type and you
should select the most appropriate of them. This helps both you and the user
who performs data entry. Furthermore, a good design will cause you less
headache when creating calculated expressions.
Microsoft Access can assist you with allowing or
excluding categories of data in database fields. Based on this, you can make
sure that the user would not type a contract's date in a project's contact
name. To manage different types of information you enter in a database,
Microsoft Access helps you organize data by categories.
To make your database efficient, in some circumstances,
or depending on the project (or customer), you should exercise as much
control as possible on data entry. This aspect is mostly controlled at two
levels: tables and forms.
We know that, when creating a table in Datasheet View,
to create a column, you can click Click to Add, select a field type from the
list:
Type a name for the column. After creating a column, if
you want to change it, on the Ribbon, click Fields. In the Formatting
section, click the arrow of the Data Type combo box and select from the
list.
Besides the Datasheet View, you can use the Design View
of a table to specify the type of value that a field can hold. To do this,
after specifying the column name, click the arrow of the corresponding box
in the Data Type column and select the desired type:
After a field has been configured on a table, when that
field is used in a form, it would respect the formatting that was done on
the table. Even if you create an unbound field on a form, you can still
control how it accepts or rejects data. Therefore, data entry can also be
configured at the form level. To provide this functionality, a form provides
the same properties as the lower portion of the table's Design View.
To further control how data is entered and/or how it is
displayed on a field, both the table in Design View and the Property Sheet
in Form Design provide special fields.
Because the list of data types may appear short to you,
each data type provides some configuration that allows you to control how
data for that field either would be selectively entered or would display. To
do this in the Datasheet View of a table, click any field under the column
header. On the Ribbon, click Fields. Use the options in the Properties, the
Formatting, and the Field Validation tabs:
To control the properties of a table in the Design View,
after selecting a data type in the Data Type column, in the lower section of
the table, you can format or further configure the field. The lower part of
the table Design View is made of two sections: the property pages on the
lower left and the properties help section on the lower right:
The kind of Data Type you set for a field in the upper
section controls what displays in the lower section of the view. The General
property page controls the features of the selected data type. The options
in the General property page depend on the data type that was specified:
The Lookup tab allows you to specify a feature that is
particular to the specific data type that was specified. For some data
types, it would display a combo box. For some other data types, the Lookup
property page would be empty.
Data entry consists of typing values in data fields or
selecting values from bound controls. Some records happen to have the same
value for a particular field, or most records hold a common value for a
certain field. When designing a table, you can assign the most commonly used
value to such a field so the user would not have to type it. The user would
change the value only if it is different from the usual. For example, when
creating a database for a small company, all employees may have the same
telephone number but with individual extensions. When a new record is being
entered, the value would be set already for the field.
To specify a regularly used value for a field:
The default value should be appropriately typed:
Instead of a constant value, you can use a value that
depends on a built-in function. If you are using the Expression Builder, in
the left list, expand Functions and expand Built-In Function. In the middle
list, click the category the function belongs to. From the right list,
double-click the desired function, then configure the function
appropriately.
A validation rule is a condition that the value entered
in a field must meet in order to be valid. To create a validation rule:
In both cases, the action would open the Expression
Builder where you can create a rule.
When the condition in the Validation Rule field is not
respected, you can display a message box to let the user know. To create the
message:
If you think that there must be an entry for a
particular field for each record, you can require it from the user. When
performing data entry, after creating a record, the user cannot move to the
next record if a value for that field has not been provided. You can specify
that the value of a field is required when creating a table, whether you are
working in the Datasheet View or the Design View of the table:
When data is entered in fields, it is possible to have
the same value for a field in different records, such as two people who live
in the same state. This is considered as a duplicate value. In some other
cases, this may not be acceptable. For example, you may not want two
employees to have the same employee number.
You can specify the indexation of a field when creating
a table either in the Datasheet View or the Design View of the table. If you
are creating or configuring a table in the Datasheet View, to specify the
indexation of a field, click any cell of the column. Then, on the Ribbon,
click Fields. In the Field Validation section, click the check box of the
Unique option
If you are creating or configuring a table in the Design
View, in the top section, click the field. In the bottom section, click the
arrow of the Indexed property. This characteristic can be set using one of 3
values:
So far, to enter a string in a table, we assumed that
the user would type it. In some cases, this is fine. Sometimes, you may want
to limit the number of entries that a user can enter for a field. For
example, if you create a list of students and you want the user to specify
their gender, if you leave it up to the person doing data entry, you may end
up with entries such as W, Girl, Female, G, Woman, or F. Although all these
could indicate that the records designate a female, when performing data
entry, these entries would create confusion and unpredictable results.
Fortunately, Microsoft Access provides various solutions to this type of
problem.
On a table, you can create a list of values that the
user would select for a field, instead of typing the value. Such a field is
referred to as lookup. You can create the field whether in the Datasheet
View or in the Design View.
A lookup field appears as a combo box. To use it, the
user can click the arrow and select from the list. There are various ways
you can create a lookup field. In the Datasheet View:
In both cases, this would start the Lookup Wizard. In
the first page of the wizard, you must select the second radio button. In
the second page of the wizard, you will be asked to provide a value for each
item that will eventually show in the list. To do that, you would click
under Col1, type a value, press and down arrow key, and continue populating
the list. When the list is complete, you can click Next, give it a name, and
click Finish.
Microsoft Access provides a few configured lookup fields
you can add to a table. To use one of them, display the table in Datasheet
View. Click a cell under Click to Add. On the Ribbon, click Fields. In the
Add & Delete section, click More Fields. In the list that appears, click
Category, Priority, or Status. You can keep the list or change it. To change
the list, click the arrow of the combo box. Under the list, a button would
appear:
You can then click that button. An Edit List Item dialog
box would come up:
To change an item, select it in the list and replace it
with a new string. To add a new item, click under the other items or click
the end of the last item, press Enter, and type the desired item. The
Default Value combo box allows you to specify what item would display as the
default.
To create a lookup field in the Design View of a table,
after specifying a name for the column, set its Data Type to Lookup
Wizard... This would start the Lookup Wizard. You use exactly as we
described the Lookup Column from the Datasheet View.
|
Getting Assistance With Data Entry
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment