views:

103

answers:

1

Hi,

How would i set the itemdata from getting just the ID/key of a row, if i didnt know what order it is in on the list

For example I have a combo box showing the following:

cmbPeople:
ID   Name
2    Rod
4    Jane
6    Freddy

eg. I know I want Jane to be the focus of the combo box, and i have the ID but i dont know that its the second item in the list ( Me.cmbPeople.ItemData(1) )

How would I go about doing this??

Thanks in advance for any help

A: 

If ID is the bound column, you can simply say:

 Me.cmbPeople = 2
Remou
As easy as that!! Thanks alot, as you can see I am a novice
glinch
Actually its not a bound column, there is no control source for the combo box.
glinch
The bound column and the control source are two different things. The bound column is the number of the column that the combo refers to, that is, the column that gives and set the value of the combo.
Remou
The only problem is that if you do not set a control source the combo box is unbound, as far as i believe?
glinch
Got it working Remou, thanks alot, set the bound column correctly and all good, cheers.
glinch
I am glad it works for you. It is important to distinguish between the bound column for a combo and a bound control. They are two quite different things, as noted above.
Remou