Combo box that displays field from another table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following 2 tables.
1. Company Table - with fields "CoID" & "CoName"
2. Events Table - with fields "EventName" & "CoID"

I've created a form based on Events Table, and want to add a field that
displays the respective CoName from Company Table.

I've tried to create a combo box based on a query linking CoID from Events
Table & CoName from Company Table. Also, I've used the following code,
wishing to display the correct CoName in combo box in respect to the "CoID"
in the form.

Private Sub Form_Current()
ComboCoName = CoID
End Sub

However, only the CoID is displayed in the combo box instead of the CoName.
Please help. Thanks.
 
If you use CoID, CoName in that order as the RowSource of your ComboBox then
you need to set the ColumnWidths Property of the ComboBox with the width of
the first Column to zero.

Access ComboBox always so the first visible Column. Hence if you want to
show the second Column value, you must set the width of the first Column to
zero.

Check Access Help on the Column Widths Property.
 
Back
Top