0% found this document useful (0 votes)
40 views28 pages

Add A Combo Box To A Form

The document discusses adding a combo box to a form in Microsoft Access to allow users to select an artist's name rather than entering their ID number. It provides step-by-step instructions on using the Combo Box Wizard to populate the combo box with artist names from the Artists table, configure it to store the artist's ID in the underlying table, and test the new form.

Uploaded by

yes 1012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views28 pages

Add A Combo Box To A Form

The document discusses adding a combo box to a form in Microsoft Access to allow users to select an artist's name rather than entering their ID number. It provides step-by-step instructions on using the Combo Box Wizard to populate the combo box with artist names from the Artists table, configure it to store the artist's ID in the underlying table, and test the new form.

Uploaded by

yes 1012
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 28

Add a Combo Box to

a Form

DATABASE THEORY AND APPLICATION
Combo Box Wizard

Access provides a "Combo Box Wizard" to
walk you through adding a combo box to a
form.

Now that we've created our form, we could


go right ahead and enter data.

But we might encounter a small issue.


Combo Box Wizard

We'll have to remember the artist IDs of all
artists. This is because the only artist
information on the form is the ArtistId. The
artists' names are nowhere to be seen.

This means we'll need to enter the artist ID


for every album we enter.
Combo Box Wizard

This could become an inconvenience.
Whenever we enter a new album, unless we
remember the ID of every artist, we'll
probably need to open up the Artists table to
look up the ArtistId for the album we're
entering.

Time for a slight redesign of the form.


Add a Combo Box with the
Artists' Names

Here, we will add a combo box containing a
list of all artists' names to the form. This will
allow users to select artists by their name,
rather than their ID. However, the form will
still insert the ID into the Albums.ArtistId
field.
1) Add the Form Control

Open the form in Layout View.

Click the Combo Box icon from the Design


tab on the Ribbon.

Now click the form in the location that you


want the combo box to be inserted. The
Combo Box Wizard will open.
1) Add the Form Control

Before you click, as you hover your cursor over
the form, Access will display a red line wherever
you move the cursor, to help you see where the
combo box will be inserted.

The Combo Box Wizard:
Select a source for the Values

As mentioned, clicking on the form
automatically opens the Combo Box Wizard.

Select the first option: I want the combo box


to get the values from another table or query
and click Next >

3) Select a Table

Select Table: Artists and click Next >
4) Select Fields

Click >> to move both fields across to the
right pane, then click Next >
5) Select Sort Order

This determines the order in which the items
will appear in the list. We'll order them by
the artists name.

Select ArtistName and Ascending, then click


Next >

6) Column Width

Adjust the column width as desired then
click Next >
7) Select where to store the Value

 Click Store that value in this field: and select ArtistId

 Then click Next >


7) Select where to store the Value

This means that the ArtistId for the selected
artist will be inserted into the
Albums.ArtistId field.

So even though the user only selected the


artist's name from the combo box, the ID is
what's inserted into the table.
8) Combo Box Label

Type a label for the combo box and click
Finish
9) The Combo Box

Access will close the wizard and you'll see
the form with the new combo box.
Delete the old Control

You have the option of keeping the ArtistId
form control or removing it.

To delete the old control (and its label) click


on each one while holding down the Shift
key. Then right-click and select Delete from
the contextual menu.

Test the Form/Combo Box

Go ahead and use the form to add new
records to the database — now's your
chance to add something from the last
25 years ;).
1) Go to a New Record

Switch to Form View (either by clicking
the View button on the Ribbon, or the
Form View icon at the bottom right of the
screen) and open a blank record.

To open a blank record, click the New


(blank) record icon at the bottom of the
screen.

2) Enter Data

Enter data as a user would.
Tabbing or pressing Enter past the last
field will submit the form and insert the
contents into the table.
Note that, to display the date picker
icon, you'll need to click inside the
Release Date input control.



End.

You might also like