This code shows how to display specific
itemdata in a ComboBox. Currently, only the
listindex property is available to navigate through a ComboBox.
' Consider a set of employee details
' EmpNum EmpName
' 100 Tamara
' 101 Chidongo
' 102 Mphatso
' 103 Twiza
' When you select a record EmpNum = 102 from the database, and display
' it in a form, you may also want your combobox to display "Mphatso"
' instead of "Tamara" (listindex = 0). To display "Mphatso" in the
' combobox:
'
Dim q as integer
Dim lEmpNum as Double
lEmpNum = rsEmp.Fields("emp_no").Value
For q = 0 To cboComboBox.ListCount - 1
If cboComboBox.ItemData(q) = lEmpNum Then
cboComboBox.ListIndex = q
Exit For
End If
Next q