[Music]
now we're going to populate our database
now all that really means is that we're
entering data records into it this can
be done a few ways one of which is by
entering records directly into a table
we'll do that with the books table first
so we can start entering the books we
have to sell our books table is empty it
has no records in it so we're going to
add some in Access you enter records
into a table and datasheet view which is
how the table opens to add a record to
an empty table type the record into the
row with the asterisk we don't need to
enter anything into the book ID field
because the data type is set to auto
number so this fields will assign a
unique number to each record you enter
we already set the price data type to
currency so when someone enters numbers
here it appears there's a dollar amount
if I try to enter text here I get this
message it lets me know that the data I
interr does not match a currency data
type that I set up
I'm going to add one more record I want
to point something out to you that has
to do with formatting if you look
closely you'll notice that you can't
really see the entire title so I'm going
to double click on the line between the
two fields to expand my title fields
that's a lot better now we should make
sure the info that will be entered into
the fields is formatted properly so that
is accurate it can be useful later this
is called data validation and it is done
by setting the field properties in
design view you've seen this view before
when we set up the data types up here
and now we'll be setting some of these
properties in the bottom half of the
window we'll start with the validation
rule we'll set it up so that the price
must be greater than zero because we're
not giving books away now the validation
text is what you want to appear for your
user when they enter something
incorrectly so if they were to enter 0
for the price we want a message to pop
up that says must be a dollar value
higher than $0 the required field
property is set to know by default but
in this case it must be set to yes so
that a user has to enter a price for
each book in our store they will never
be allowed to not enter a price let's
take a look at the default field
properties for a field that has a text
data type field size refers to how many
characters the user can type in for the
category field we don't know how long a
category name may be so we'll leave it
set to the default to 255 characters
which is probably way more characters
than we'll ever use but you never know
I also want to set up a validation rule
for category I want the database user to
have to enter one of the categories
that's used at the store I'll use the
expression builder to do this the
validation rule starts with an equal
sign we'll place quotation marks around
each category name which will tell
access that it needs to check the
entered data to make sure it matches
exactly one of the choices we have
inside the quotation marks so if someone
enters something in lowercase or a
category that's not in the list it won't
accept the data this helps cut down on
data entry mistakes I'm inserting or
between each word which simply means I'm
giving access lots of options to choose
from
I'm telling access this field must
include fiction or nonfiction or kids
and so forth
now so users know what we expect of them
we have to set the validation text to
read must be fiction nonfiction and so
on this text is what our user will see
if they enter a category that doesn't
match what we have told access to accept
just like when we set the price to be
greater than zero earlier so all of the
settings here look good I'll save my
changes ok as soon as we enter
nonfiction in our category field earlier
before setting our field properties I
received this message saying data
integrity rules have been changed
existing data may not be valid for new
rules by clicking yes I can choose to
have my data test sent with the new
rules so I'm going to do that now let's
get back to entering records I want to
show you how the validation rule works
so for category I'll enter cooking when
it really should be food see I get a
message it tells me I must enter one of
the following options I'll go ahead and
correct this let's take a look at the
customers table now sometimes you may
have to enter data into tables that
already have a lot of data records in
them you can see that I've already added
some records to this table I can see
that it's populated with 10 records by
taking a quick glance but I can also see
the number of records here at the bottom
left side of the table this is a record
navigation I can choose to go back to
the first previous/next or last record
or create a new record from here I can
also create a new record from the home
tab by clicking on noon in the records
group
now all I have to do is enter my data
sometimes you'll need to edit a record
that already exists in the table for
example let's say one of our customers
has gotten married and I need to change
her name
I could take time to look through every
single record to find this one customer
but what if I had thousands of records
it would be much much easier to use a
find feature to finds and replace an
entry from the Home tab click on finds
in the finds group the finds and Replace
dialog box appears type in what you want
to find here I want to find Williams so
I can change Kiara Williams to Kiara
Rogers so I'll click on the replace tab
and type in Rogers beside replace width
[Music]
this down here shows the last field I
was in happens to be the customer ID
field and then I'm searching the whole
field for a match and that I want to
search all records in the table and I
don't want to search the customer ID
field for this information so I'm going
to click the drop down arrow and choose
a search of customers table to find this
information click find next to find the
information and then replace to make the
change sometimes you may want to copy
and paste a record let's go back to the
books table it's common to have more
than one volume of a particular book
like state parks Volume one and state
parks volumes two to copy a record
select the record right-click and select
copy now select the new record
right-click and select paste now all I
have to do is make this volume two now
you know how to work with records in a
table itself and you can see that you
have to be careful and how data is
entered into a database because you only
get out of the database what you put
into it like what you just saw greatest
add a comment subscribe to our Channel
the freedom to learn
what you want when you want absolutely
free
GCF learn free.org