Microsoft-Access Tutorial

Microsoft-Access Tutorial

Combo box – table look up

We will now make the Room type combo box shown on Figure 3.1E. This combo box might be another sorting criteria. The combo box is not an enumeration type where the designer has typed in the values, but a table look up. In the example it stores a roomType ID, but the user will see the name of the room type.

1. Switch to design mode and make sure the Wizard button is on.
2. Select the Combo box tool and draw the Room Type box.
3. Tell the Wizard that you want the combo box to look up the values in a table. Click Next.
4. Select tblRoomType as the source. Click Next.
5. Tell the Wizard that you want to show these fields as columns: roomType, description. Click Next.
6. Ask the Wizard to hide the key column. This means that the key will be stored, but the description shown to the user. Finish the Wizard.
Try out the combo box in user mode. It should look all right.
The bottom of Figure 3.1E shows the Data tab for the combo box:
• Row Source now contains a formula called an SQL-expression. It specifies how to compute the list that the user will see. We will look at SQLexpressions in section 4.2.
• Bound Column indicates the column that holds the value to be stored in the table. In our case it is column one, which holds roomType.
We won’t use these combo boxes later in the booklet. You may leave them on the form or delete them.

Cours gratuitTélécharger le cours complet

Télécharger aussi :

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *