Microsoft KB Archive/248382
Article ID: 248382
Article Last Modified on 6/24/2004
- Microsoft Access 2000 Standard Edition
This article was previously published under Q248382
Novice: Requires knowledge of the user interface on single-user computers.
This article applies to a Microsoft Access database (.mdb) and to a Microsoft Access project (.adp).
On a data access page, you can use a drop-down list to display or to look up specific values. This article shows you how to do so.
For example, assume that a data access page displays order information. This information includes the order number, the customer number of the customer who placed the order, and an order date. But you do not want to display the customer number. Instead, you want to display the name of the customer. But, the name of the customer is not in the recordset of the data access page.
To display the customer name instead of the customer number on the data access page, use a drop-down list. Drop-down lists have four properties that you can use to display the data that you want:
- ControlSource property. The control source is the source field to which the drop-down list box stores the value.
- ListRowSource property. The list row source is the source table or source view that contains the values to be displayed in the drop-down list box.
- ListBoundField property. The list bound field is the field that is bound in the specified list or combo box (as opposed to the field that is displayed).
- ListDisplayField property. The list display field is the field within the specified row source to be displayed in the drop-down list.
For an example of how to use these properties to display the customer name instead of the customer number, follow these steps.
CAUTION: If you follow the steps in this example, you modify the sample database Northwind.mdb. You may want to back up the Northwind.mdb file and follow these steps on a copy of the database.
- Open the sample database Northwind.mdb.
- In the Database window, click Pages under Objects, and then click New.
- In the New Data Access Page box, click Design View, click the Orders table in the Choose the table or query where the object's data comes from box, and then click OK.
- If the field list is not displayed, click Field List on the View menu, and then drag the OrderID, CustomerID, and OrderDate fields from the field list to the page.
- If the toolbox is not displayed, click Toolbox on the View menu, and then add a drop-down list control to the page by clicking the Dropdown List Control in the toolbox. Do not use a Control Wizard by making sure that the Control Wizards button does not appear pressed in.
- On the Data tab of the drop-down list control:
- In the ListRowSource property box, type Recordset: Customers. Then, click Table: Customers in the ListRowSource drop-down list. Note that the property changes to Recordset: Customers.
- Set the ControlSource property to Customer ID.
- Set the ListBoundField property to CustomerID. Note that the property changes to CustomerIDx: CustomerID where x is the next CustomerID object reference.
- Set the ListDisplayField property to CompanyName.
- Save the page and preview it. Note that, as you move through the records in the Orders table, the customer name appears in the drop-down list.
Additional query words: dropdown list controlsource listrowsource listboundfield listdisplayfield look-up look up
Keywords: kbinfo kbdap KB248382