chpicker
Programmer
- Apr 10, 2001
- 1,316
Ok, I have been thoroughly frustrated with combo boxes for some time now. They never seem to behave the way I expect them to. I can't even remember all the problems I've had that I ended up giving up on and trying a different way. In any case, here's my latest.
In the init event of the combo box, I create a public array of 15 rows and 2 columns. I use a FOR i=1 to 15...NEXT loop to populate the second column (i,2) with (i-1) so I get the numbers 0 to 14 in it, numeric type. I then assign column 1 of each with a different character string.
I set the combo box to have 2 columns, boundcolumn of 2. It displays the character string, but the Value property returns the number...except that the number is of type C!? And no matter what I try, the combo box starts BLANK, on a non-existant 16th entry at the bottom of the list which disappears as soon as I pick a different entry. And, again, the Value property and any variable I assign to the ControlSource returns the right number, but it's of type C.
When I used RowSourceType 1 and populated the combobox with a comma delimited string, it worked fine, and I set the initial item with the line THIS.VALUE='All', 'All' being the character string of the first item. But I don't want the control to return a character string...I want it to return the number in the second column of the array.
Any ideas? I have yet to get a combo box to behave the way I thought it should...and most of the property descriptions under the Data tab don't make much sense to me.
In the init event of the combo box, I create a public array of 15 rows and 2 columns. I use a FOR i=1 to 15...NEXT loop to populate the second column (i,2) with (i-1) so I get the numbers 0 to 14 in it, numeric type. I then assign column 1 of each with a different character string.
I set the combo box to have 2 columns, boundcolumn of 2. It displays the character string, but the Value property returns the number...except that the number is of type C!? And no matter what I try, the combo box starts BLANK, on a non-existant 16th entry at the bottom of the list which disappears as soon as I pick a different entry. And, again, the Value property and any variable I assign to the ControlSource returns the right number, but it's of type C.
When I used RowSourceType 1 and populated the combobox with a comma delimited string, it worked fine, and I set the initial item with the line THIS.VALUE='All', 'All' being the character string of the first item. But I don't want the control to return a character string...I want it to return the number in the second column of the array.
Any ideas? I have yet to get a combo box to behave the way I thought it should...and most of the property descriptions under the Data tab don't make much sense to me.