If I understand you correctly, you want a ComboBox that displays a list of country names and stores some sort of country code. You can use a ComboBox to display and store a field, but not to display one field and store another. Unlike the ListBox control, the ComboBox does not have a Bound Field
property, which is required to use two fields. The Bound Field
property determines what field is stored in your target table.
You need to use a ListBox control to get this functionality. The ListBox control should give you a wizard. First select the table the you want to display data from.
Then select the field you want to display.
Lastly, select the field you want to store the value to (left-side list) and the field you want to get the value from (right-side list). NOTE: In this example, I am only using one table. So I have the same options in both the left-side and right-side lists. Normally, you would pull this data from another table to be displayed and stored in the current - usually as some sort of foreign key relationship.
Then we need to make the ListBox act like a ComboBox, that is, make the ListBox have a dropdown menu. Right-click the ListBox and go to Control
. Set the DropDown
property to Yes
. Set the LineCount
to however many items you want displayed without needing to scroll (I like 5, personally). Lastly, set the Height
to something more like what a Text field would be.
Reference: http://user.services.openoffice.org/en/forum/viewtopic.php?p=164740#p164740