now we need to work on our orders form
which is the most crucial of our forms
it's where we'll have our database user
the store employee identify what book or
books are being ordered by which
customer now we already have the basic
form set up it was created just like our
other forms it shows all the fields that
are in the orders table and it is
currently showing the first record in
the orders table the setup of this form
isn't very useful to someone who is
entering orders all of these IDs really
don't mean much the person taking a new
order the only thing a person entering
data would care about is the customer
name and the book title in other words
who ordered what now as our database
owner we want to restrict the use of the
form to only entering new records so
that the person using the form doesn't
accidentally overwrite an existing order
we wanted to open to the new record each
time so let's set up that level of
control right now
first let's rename the form new orders
so our user can tell at first glance
that he or she should be entering only
new orders to make it so that records
can only be added we have to set the
form properties you can do that in
design view if the property sheet is not
already open click on the property sheet
command in the tools group under the
design tab now make sure form is
selected from the drop-down since that's
where we want to make our changes
now we'll set a few options under the
data tab the text in the lower left
corner of the window helps you know what
each field property does so if we click
in data entry we know it is asking you
if you want to only allow new records to
be added so we'll change notes yes we
want to be able to allow additions so
this will remain yes now we don't want
to allow deletions so we'll set that to
no and we also don't want our users who
edit data from the orders form
so we'll set that to no now we have a
form for our employees to enter new
orders so now let's look at this form
from our users point of view how would
he or she want to use it when a customer
brings a book to purchase or order now
you see the default view for entering
new orders let's quickly dissect this
form order ID is just a unique number
that the database assigns to each order
this isn't an editable field and it
isn't something the user whatever needs
a touch so we'll hide the order ID to do
that switch to design view highlight the
field box and its label bring up the
property sheet for these boxes if it's
not already open under the format tab
select snow beside visible now I'll
switch back to form view so you can see
that the order ID field is hidden next
we see customer ID and book ID they
obviously aren't very usable like they
are now but we'll come back to those in
a minute let's consider the order date
field as a database owner we want the
date to default to the current date
since no customer will place an order
for any other day than today and we will
want the information in our table but
the person entering the new order
wouldn't need to enter that so to set
that up go to design view highlights the
field box and bring up its properties
sheet if it's not already open we want
to double check and make sure the
drop-down is set to order dates from the
data tab we want to make sure the
default value is set up to always enter
the current date we'll use the
expression builder to enter this
function the function starts with an
equal sign so I'll go ahead and click
equals next we need to click the common
expressions folder in the first column
in the center column we'll click on
current
eight in the third column will click on
date all this equation really means is
that we want this field to always
automatically enter the current order
date we're finished with the data tab so
let's go to the format tab to hide this
field too since we were automatically
putting today's date in let's take a
look at the form in form view now our
form user just has to worry about
getting the right customer ID in the
right book ID but the ID numbers don't
help them very much as they are since
they'll be dealing with a real person
with a real book and not a customer ID
with a book ID to make sure our user
enters the correct customer we will want
him to choose from our list of customers
but we want the database to store the
customer ID number and not the name
since that is a unique identifier for a
customer well with the combo box control
we can put all the information our user
needs right on the new order form itself
this box will let them choose the
customer based on a list of the customer
names that appear in our customers table
and we can set the form controls up so
that once our user picks a customer from
the list the customer ID is stored in
the orders table let's do this now since
we're using a combo box I really don't
need this text box or label anymore so
I'll delete it next we'll click on the
combo box command in the controls group
then we'll move our cursor over our form
until we see a crosshair with a combo
box icon now we're going to draw the
combo box from the wizard we'll choose
the first option by choosing this option
we're telling access to find what we
want the user to see in the combo box
now we needed to look in the customers
table and we need all the fields so that
our form user can see a complete record
in order to figure out which customer he
needs to enter
we wanted to sort alphabetically by last
name since that is a logical way for our
users to look up a customer here we can
set the column width so that it all
looks nicely compact on our form
double-click the column edges to get it
to best fit we also have to move the
last name column over to the left so
that we see the last name listed first
in the drop-down list next we want to
tell access to store the data so we'll
select the second option this option is
asking which value from the orders table
we want store it in orders table and we
want to store our customers ID number so
selects customer ID from this list this
is the label for the combo box will type
in customer here well it looks like
we're finished here we'll go to form
view to take a look if you want you can
move the label and the combo box but
we'll take a look at formatting in our
next lesson now we're going to do the
same thing for book ID our form user
isn't going to know the book idea of the
book so we'll want him to be able to
search on the book title and author I'll
go ahead and finish this up really
quickly one more enhancement that would
make this form more usable is to add a
button so that when our form user enters
a new record they can hit this button to
save the record to the orders table and
advance to the next new record here's
how you do that click button on the
controls portion of the ribbon move your
mouse over the form until the crosshair
with the button icon appears draw your
button wherever you want it to appear on
the form you can always move this button
later when our button is pushed we
wanted to save the current record and
advance to a new record so from the
categories list we'll select record
navigation and from the action list
we'll select go to next record the
next screen lets us decide whether or
not we want text or a picture on the
button I want the text to read submit
because that's what we generally see on
forums where we have to enter and send
information
now once a user clicks submit the
information will be saved to the orders
table also by hitting submit we advance
to the next blank record on the next
screen we can choose to give this button
a special name this could be handy if
you have several buttons and you need to
know which is which if you ever have to
edit the buttons later I'll type in
submit here let's go back to form view
and test out our new form so now if
Jimmy Smith purchases Computer Basics it
will be much easier to enter and save
the new record to our orders table as I
said before by clicking submit access
automatically saves the record to the
table but you may have to click refresh
all in the orders table to see the
change so you've learned how to make
forms really user-friendly by adding
command buttons and setting form
properties and our next lesson we'll
learn how to make this form look good