We've already looked at how tables store information in a database, but you're not always going
to be entering data directly into a table.
Much of the time, you're going to be using forms instead.
A form gives you a more user-friendly interface for entering data, and they make sure that
the data goes exactly where it needs to.
Sometimes, the data just goes to one table, but other times it could be several different
tables—and a form can keep track of that so you don't have to.
Right now, we're looking at the Customers form that was created for our database.
And this gives us an easy way of adding or changing information in the Customers table.
The difference is, here we can just focus on one record at a time, and there are also
some specialized tools like drop-down boxes and buttons for saving, deleting, and printing.
We can use a drop-down box to find an existing customer… and we could also type a last
name to jump to a record.
And when we click on the name… their information will appear in these fields, where we can
then edit it.
I'm just going to change this customer's address.
Now some fields may have a validation rule that limits the type of data that can be entered.
For example, here, the state needs to be a 2-letter postal code, and if I try to type
anything else, a window will pop up with instructions on how to fill it out correctly.
And I'll change this back to NC.
And when you're done, you can click Save.
There's also a button to create a new record… which automatically clears all of the fields
so we can type in a new customer's information.
So if you wanted to, you could do most of these things by editing the table directly,
but the form is going to be a little easier and faster to use.
Now let's look at a slightly more complex form, and this is going to let us do things
that we really couldn't do by just editing the tables.
I'm going to open the Orders form… and this is what the employees will fill out when the
customer places an order.
Let's just walk through the process of creating a new order.
When you click New Order… it clears all of the fields.
And then you can choose the name of the customer that's placing the order.
The information in this list comes from the Customers table, so every customer will need
to already be in the database before they can place an order.
And it automatically generates a new order number.
When you click on the Pickup Date field, a calendar button appears… which makes it
easy to quickly choose the date that you want.
And there are also a couple of checkboxes for simple yes or no questions.
Later, when you start creating forms, you'll be able to add these types of special tools
to make your forms easier to use.
And this form has a field where you can add notes if you want.
Now here's where this form is a little bit different.
When you click Add Item, it opens what's called a sub-form.
And here you can choose the item that was ordered… type in the quantity… and then
save and close.
If the form doesn't update automatically, you can just go to the drop-down arrow below
the Refresh command… and select Refresh.
Then you can add another item.
And you can do this as many times as you need to, until the order is complete.
Okay, now let's take a look at why forms are so important.
When we place an order with this form, one of the tables that is modified is Order Items.
Now it would be very difficult to edit this table directly.
For instance, I don't know what Menu Item 156 is, and I don't remember which customer
placed order number 7—but Access can piece together the order by looking up the correct
records in different tables.
So tables are sometimes organized in a way that's easy for Access to read, but difficult
for a person to read, and that's why we often have to use forms instead of editing tables
directly.
These were just a couple of examples of forms, and the exact content and layout of a form
will vary depending on how the form is meant to be used.
But the basic process of using a form will generally be very similar, and it will be
a combination of typing information into fields, and using drop-down menus, buttons, checkboxes,
and other tools.