Create a lookup column
In a Microsoft Access project connected to a Microsoft SQL Server 2000 database, you can add a lookup column. A lookup column displays values in another table's column that correspond to the lookup column's value. For example, a CustomerID column in an Orders table that is a foreign key to a Customers table. In this case, you want to display information about the customer, such as the customer name and address, rather than the number in the CustomerID column.
- In the Database window, click Tables
under Objects, click the table you want to open, and then click Design on the Database window toolbar. - Select an ID column, such as the foreign key column, and then click the Lookup tab.
- Define the lookup column by setting the following properties:
- In the Display Control, select the type of control you want to use for the lookup column in a form.
- Select Text Box to create a text box.
- Select List Box to create a list box and make the next six properties available.
- Select Combo Box to create a combo box and make all subsequent properties available.
- In the Row Source Type, enter the type of row source Tables/Views/Functions, Value List, or Field List).
- In the Row Source property, enter the name of the row source:
- In the Bound Column property, enter the number of the column you want bound to the underlying field for a bound multicolumn list box or combo box. This number is an offset: the first column is zero, the second column is 1, the third column is 2, and so on.
- In the Column Count property, enter the number of columns you want displayed in the list box or combo box.
- In the Column Heads property, select Yes if you want to display column headers.
- In the Column Widths property, enter the width of each column in inches, separated by semicolons, for example, 2;3. To hide the bound column from the display, use a width value of zero, for example 0;2.
- In the List Rows property, enter the maximum number of rows to display in the list box portion of a combo box.
- In the List Width property, enter the width of the list box portion of a combo box in inches.
- In the Limit To List, property, select Yes to restrict a combo box to displaying only values in the list. Select No to allow a user to enter text that doesn't match a value in the list.
- Click Save
to save changes and switch to Datasheet view to verify your results.
Note You can add more than one lookup column to a table.