Field reference

Z

zzzaps

2 fields one in 'Look-up' mode and the other a description. Hw do you link
the descption field to reflect what is in the 'look-up' field while scroling
throught the look up. Say, the look-up is a part number and the description
field should display the data in the table referenced to the part number, I
know there must be some way of doing it.
 
S

Sprinks

zzzaps,

If you are using the Lookup feature offered at the table design level, I
strongly advise that you don't, and that you use a combo box instead. Search
this forum for the reason why; Dirk Goldgar has covered this topic well.

Include both columns in the combo box, set the ControlSource to the
numerical foreign key field in your table, set the BoundColumn to 1 to store
the key, set the ColumnWidths property to 0";x" (x = number large enough to
display the widest description).

Your RowSource query statement will be something like:

SELECT MyTable.ID, MyTable.Description
FROM MyTable
ORDER BY MyTable.Description;

The description will display after you make a selection since it is the
first column with a non-zero column width.

If you also wish to display the code, you can display it in a textbox by
setting its ControlSource to:

MyComboBox.Column(0)

Sprinks
 
Top