in our previous lesson we focused on
designing our database
we said that we wanted a customers table
and orders table in a books table so
let's start by creating our books table
now I could have started with customers
orders or books but in this case I think
it makes sense to start with books since
we need to have our inventory of books
before our customers can place an order
I've already opened access from my Start
menu so now we need to decide whether we
want to use a built-in template or start
from scratch using a blank database
let's start from scratch click on the
blank database icon to open a new
database now we need to name the
database by default access assigns a
name and also adds the file extension
even if you delete it while you're
entering your name just delete this to
name your database in this case I'll
name it ready to read and click create
the database opens in datasheet view and
you'll see table 1 listed in the
navigation pane and on the table tab to
the right table 1 is the default name
access assigned to your first table to
give the table a unique name click the
Microsoft Office button and select save
from the menu it's I log box will open
asking you to name your table I'll name
it books and then click OK the new name
changes in the navigation pane and on
the table tab it looks like I misspelled
books to rename a table go to the
navigation pane right click on the table
and select rename if your table to the
right is open you'll receive a message
telling you to close it before you can
rename just click OK to close a data
table to the right right click on the
table tab and select close now
right-click on the table in the
navigation pane and select rename
sir appears which means we can start
typing left click anywhere outside of
the field to make the change next
double-click on the table to reopen by
default XO starting us out with one
table to create additional tables click
on the create tab and then table in the
tables group a new table tab appears now
from the Microsoft Office button select
save to name your table we'll name this
one customers we have one more table to
add and that's going to be the orders
table you can always tell which table
you're in by seeing which tab is
highlighted so currently we're in the
orders table I'm going to go back to the
books table by clicking on the books tab
now let's start adding some fields by
default access starts us off with an ID
field the ID field is already set to
auto number which will give each record
a unique number remember each record is
one row of information each table you
creates and access will have this ID
field so it's a good idea to give this
field a unique name in each table
because it will be much easier to
understand later we'll name this book ID
by clicking on the ID header and then
click on rename in the fields & columns
group on the ribbon let's add our other
fields to do this double click on add
new field the text will disappear so you
can enter your fields name
we'll start with title once you've added
this new fields you can press a tab key
on your keyboard to add other fields
repeat these steps until all of your
field headers have been entered so I'm
going to quickly add all of my field
headers here
in access we can work in datasheet view
which is our current view or design view
datasheet view is kind of like working
with cells in Excel where a design view
gives you more control over the
information you enter in two cells which
in this case are actually fields let's
take a look at the design view the views
option appears under the Home tab and
the datasheet tab which is a tab that is
currently open click the drop down arrow
under the views option and select design
view the benefit of setting up our
fields here is that we can tell access
to allow only certain types of data to
be entered into a field for example I
need to add a price field I can do that
here under field name if I press tab on
my keyboard I'm now in the data type
field this field is used to define the
type of data that can be entered we'll
talk about data integrity and validation
later by default the data type is text
if I click the drop down arrow I can see
additional options
since price deals with money I'll change
my data types of currency you won't see
any immediate changes by changing the
data type but you'll notice it later
when we start entering data the
information here at the bottom will be
discussed later so there's no need to
worry about it right now
I'm going to switch back to datasheet
view to finish setting up the fields and
my tables whoops looks like I have to
save my table before I move on now we
can switch back to the datasheet view
now let's add fields to the customers
table now as I said before the first
field is the ID field by default we'll
rename this field by clicking on the
datasheet tab under table tools and then
rename and the fields and columns group
so now we're going to call this customer
ID
I'll go ahead and add all of my other
fields now once I've added all of my
fields I can reorder these fields by
dragging and dropping here I'll show you
how to do it click on the field header
move your mouse in the area of the
header and when you see a cross with
arrows hold down your left click mouse
button and drag the column to another
location I can also delete a field by
clicking on the fields I want to get rid
of and from the fields and columns group
on the ribbon click delete now if you
inherit this database means someone else
set it up for you you want to be careful
if you decide to delete anything in a
database because it could impact other
parts of the database we're almost
finished now we need to add fields to
the orders table
I'll start by changing the ID field
earlier we talked about the ID fields
and how they assign a unique number to
each record for our orders table we want
to figure out who is ordering our books
so the first field I'm going to create
is the customer ID field this is where a
customer's unique ID number will reside
the next fields will be the book ID this
will tell me which book my customer
ordered I'll explain more about the
customer ID field in the book ID fields
in our next lesson remember the point of
our orders table is to see who ordered
what and when so we need to add a date
field now we just learned how to use
design view to change the data type but
we can also do it from the ribbon and
the data type and formatting group to do
this click on a field header and then
click on the drop-down menu beside data
type
automatically defaults to text but since
we want to know the order dates we're
going to change it to dates and time now
immediately you don't see any changes at
all but once we start entering our data
later you'll see this calendar icon come
up again we'll talk about this a little
later setting up tables and fields in
Access is just the beginning now we need
to link them all together to build the
relationships in our relational database
because that is where the real power is
in Access