WEBVTT
Kind: captions
Language: en

00:00:14.360 --> 00:00:16.609
modify fields in your tables.

00:00:16.609 --> 00:00:18.589
Access makes it easy to do this,

00:00:18.589 --> 00:00:21.789
although there are some important things that
you'll need to consider.

00:00:21.789 --> 00:00:23.859
There are three different rules that you can
apply

00:00:23.859 --> 00:00:25.980
to control the type of data that the fields
can

00:00:25.980 --> 00:00:27.029
accept.

00:00:27.029 --> 00:00:30.220
And these are data types, character limits,
and

00:00:30.220 --> 00:00:33.010
validation rules.

00:00:33.010 --> 00:00:34.870
To get started, make sure that you have a
table

00:00:34.870 --> 00:00:35.449
open.

00:00:35.449 --> 00:00:38.219
I'm using the Customers table.

00:00:38.219 --> 00:00:40.120
We're going to scroll all the way to the right

00:00:40.120 --> 00:00:44.329
until you see the blank field that says
Click to Add.

00:00:44.329 --> 00:00:46.039
And when you click on it, you'll see a list
of all

00:00:46.039 --> 00:00:49.019
of the data types that you can choose from.

00:00:49.019 --> 00:00:51.660
Text is the default option, and this is the
type

00:00:51.660 --> 00:00:53.460
that you'll use for regular text,

00:00:53.460 --> 00:00:56.019
such as a person's name or address.

00:00:56.019 --> 00:00:58.129
You'll also use it for numbers that aren't
used in

00:00:58.129 --> 00:01:01.570
calculations, like a phone number or zip code.

00:01:01.570 --> 00:01:06.020
For any numbers that you might want to do
calculations with, you'll need to choose Number.

00:01:06.020 --> 00:01:10.110
For example, you would use this for the quantities
of an item that were sold.

00:01:10.110 --> 00:01:12.030
If you're dealing with money, then you'll
choose

00:01:12.030 --> 00:01:13.450
Currency.

00:01:13.450 --> 00:01:17.280
And if you choose Date &amp; Time, then when you're
editing that field you'll see a calendar icon

00:01:17.280 --> 00:01:19.770
which you can click to select a date.

00:01:19.770 --> 00:01:22.240
But in this case, I just want a simple Yes
or No

00:01:22.240 --> 00:01:24.700
answer, so I'll choose this one.

00:01:24.700 --> 00:01:27.250
And this adds a checkbox for each record.

00:01:27.250 --> 00:01:29.860
Then, you can type in the name of your field.

00:01:29.860 --> 00:01:34.180
I'm going to name it 'Add to Mailing List?'
Then

00:01:34.180 --> 00:01:37.840
I'll resize this field.

00:01:37.840 --> 00:01:40.140
Now we can just check each customer who wants
to

00:01:40.140 --> 00:01:42.950
be on our mailing list.

00:01:42.950 --> 00:01:44.899
And you can also click and drag the name to
move

00:01:44.899 --> 00:01:47.610
the field wherever you like.

00:01:47.610 --> 00:01:49.610
If you decide that you need a different data
type

00:01:49.610 --> 00:01:50.560
for a field,

00:01:50.560 --> 00:01:54.439
then you can just select it, and then
go to the Fields tab

00:01:54.439 --> 00:01:57.619
and click the Data Type drop-down arrow.

00:01:57.619 --> 00:01:59.820
I'm going to change this to text so that I
can add

00:01:59.820 --> 00:02:02.890
additional information in this field.

00:02:02.890 --> 00:02:04.719
Some of our customers want to receive our
weekly

00:02:04.719 --> 00:02:05.850
newsletter,

00:02:05.850 --> 00:02:09.200
but others just want to hear about our
special events.

00:02:09.200 --> 00:02:11.120
Now you should be very careful about changing
the

00:02:11.120 --> 00:02:12.010
data type

00:02:12.010 --> 00:02:16.340
because it is possible to lose some of
your data if you change it to the wrong type.

00:02:16.340 --> 00:02:18.370
In some fields, you may want to narrow down
the

00:02:18.370 --> 00:02:21.340
data even further by adding a character limit.

00:02:21.340 --> 00:02:24.069
And you can only do this with text fields.

00:02:24.069 --> 00:02:25.950
For example, we want all of the states to
be

00:02:25.950 --> 00:02:27.730
formatted the same way,

00:02:27.730 --> 00:02:31.319
so we're only using the
two-letter state abbreviations.

00:02:31.319 --> 00:02:33.849
If some of the records say NC, and others
say

00:02:33.849 --> 00:02:35.150
North Carolina,

00:02:35.150 --> 00:02:37.590
then Access won't know to group
them together,

00:02:37.590 --> 00:02:41.480
which means our sorts, filters, and
queries may not work right.

00:02:41.480 --> 00:02:44.620
In the Fields tab, find the field size box.

00:02:44.620 --> 00:02:48.500
The default field size is 255 characters,
but I'm

00:02:48.500 --> 00:02:51.989
going to change it to 2.

00:02:51.989 --> 00:02:53.569
And you may get a warning message here,

00:02:53.569 --> 00:02:57.810
so if you're sure you want to change the
field size, click Yes.

00:02:57.810 --> 00:03:00.700
In this case, setting a character limit isn't
quite good enough

00:03:00.700 --> 00:03:04.920
because somebody could still
type a two-letter code that's not a real state,

00:03:04.920 --> 00:03:06.940
for example NX.

00:03:06.940 --> 00:03:09.049
To prevent that, we need to be a lot more
specific

00:03:09.049 --> 00:03:12.129
about what types of input this field will
accept.

00:03:12.129 --> 00:03:15.150
And we'll do that by adding a validation rule.

00:03:15.150 --> 00:03:17.760
In the Fields tab, go to the Validation command
on

00:03:17.760 --> 00:03:22.310
the far right, and select Field Validation
Rule.

00:03:22.310 --> 00:03:25.769
Here, I'm going to type each state abbreviation
in

00:03:25.769 --> 00:03:27.269
quotation marks,

00:03:27.269 --> 00:03:31.180
and I'm separating each one with the word
'Or'.

00:03:31.180 --> 00:03:34.159
And this may take a while.

00:03:34.159 --> 00:03:37.799
So this expression is just looking for exact
matches,

00:03:37.799 --> 00:03:41.250
but if you want, you can create
validation rules using the same syntaxes

00:03:41.250 --> 00:03:43.769
that we talked about in the query lessons.

00:03:43.769 --> 00:03:46.069
For example, you could use the Like syntax
to set

00:03:46.069 --> 00:03:47.049
a validation rule

00:03:47.049 --> 00:03:49.470
that only allows text that ends with cake.

00:03:49.470 --> 00:03:51.799
Or, if you're using numerical values,

00:03:51.799 --> 00:03:57.049
you could use greater than to make sure that
none of our quantities are negative.

00:03:57.049 --> 00:04:00.120
When you're done, click OK.

00:04:00.120 --> 00:04:04.720
Whenever you create a validation rule, it's
important to create a validation message.

00:04:04.720 --> 00:04:08.239
And this option is also under the Validation
command.

00:04:08.239 --> 00:04:10.500
This message will pop up whenever somebody
tries

00:04:10.500 --> 00:04:11.040
to type in something

00:04:11.040 --> 00:04:13.489
that doesn't follow the validation rule.

00:04:13.489 --> 00:04:15.549
The message should briefly describe the rule,

00:04:15.549 --> 00:04:18.140
so that the user can then make the necessary
corrections.

00:04:18.140 --> 00:04:20.250
In this case, I'll just mention that it needs
to

00:04:20.250 --> 00:04:24.590
be a 2-letter abbreviation.

00:04:24.590 --> 00:04:28.600
You won't need to add a character limit or
validation rule to all of your fields,

00:04:28.600 --> 00:04:31.910
but you can add one or both of them
whenever you want to control the types of

00:04:31.910 --> 00:04:38.910
information that your field will accept.

