Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a ComboBox which loads a country list, every time i select one item and then focus in other object of the form it resets to 0. This ComboBox is linked with an Integer value in the main table (it stores the index, not the string of the country).

What the heck am I doing wrong?

share|improve this question
add comment

1 Answer 1

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.

enter image description here

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.

enter image description here

Then select the field you want to display.

enter image description here

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.

enter image description here

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.

enter image description here enter image description here

Reference: http://user.services.openoffice.org/en/forum/viewtopic.php?p=164740#p164740

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.