Office 2007 - Access

Lesson 39: List Box and Command Buttons

39/72 Lessons 

“List box”

An alternative to a “Combo box” is a “List box”.
A box shows us all the options out there to choose from.
In the previous image in which I have worked with a CustomerID, which incidentally is a number, it might be easier to choose a customer from a list.

To insert a list box, first select the “Design View” of the “Form”.
In the “Design” contextual tab, I click the “Wizard control” button.
Then click the “List” button in the “Ribbon”.
Then click and drag the field into the “Form” where we want to add the field.
This opens the wizard.
Since all these steps are the same as the “Combo Box”, I will not go any further.
Perhaps if you had typed the list manually, in other words, if you had chosen “I will type the values I want” in the first screen of the wizard , then you’ve had the opportunity to edit this list in “Form View”.
Click on the “Edit List Items” button.
In the dialog that appears, you can add items and if you wish to, enter a default value.

If you want to disable this option then go to “Design View”, select the newly created menu and click the “Properties Window” button in the “Ribbon”.

In the “Properties window”, select the “Data” tab and select “No” in the “Allow Value List Edits”

“Command Button”

We use a “Command button”, when we want to perform an action in a single click.
This action may consist of running a “Report”, “Query” or “Macro”, even the running code that previously was programmed in “Visual Basic”.

In “Design View”, click the “Command Button” option in the “Ribbon”.

You click and drag to the location in the “Form” where you want the button.

This opens the “Command Button Wizard”.
In the first wizard window, we must determine what should happen when we click the button.
As you can see in the picture below, these actions are divided into categories.
When you select a category in the left part, the different actions in this category are shown in the right part.
All these different actions seem clear to me, so I will not discuss them here.
For this example I want to add a new record at the click of the button, so I choose this action, and click the “Next” button.

In the second window of the wizard I decide whether I want this button with a text, or that I want to provide an image.
I choose the later option, and click the “Next” button
In the third and final screen of the wizard, I give this button an appropriate name.
This makes it easy when I later want to refer to this button for some reason.
I click the “Finish” button.

Now, when you click this button in “Form View”, “Access” will add a new record.

Awesome!
You've completed Lesson 39
START NEXT LESSON