-
Combo Box
I have the combo box on the form. The Style property is Dropdown List. It is populated by the code bellow:
Do Until rsNext.EOF
frmLogin.cboTeam.AddItem rsNext![full_name]
frmLogin.cboTeam.ItemData(frmLogin.cboTeam.NewIndex) = rsNext![AssociateID]
rsNext.MoveNext
Loop
I need to select some item, let say 'John Smith', pragmatically. Can I do that?
Thanks
-
Re: Combo Box
Do Until rsNext.EOF
frmLogin.cboTeam.AddItem rsNext![full_name]
frmLogin.cboTeam.ItemData(frmLogin.cboTeam.NewIndex) = rsNext![AssociateID]
If (rsNext![Full_Name] = "John Smith") then
frmLogin.cboTeam.ListIndex = frmLogin.cboTeam.NewIndex
End If
rsNext.MoveNext
Loop
Is that what you want ?
Heulsay
-
Re: Combo Box
You can select a particular value by using following code:
Combo1.listindex = 1
where 1 is the index of item in the list
This will select the second item in the combo box.
Remember Items in Combo start from 0 i.e. Index of first item in combo is 0