How to make the itemdata of combobox as the recordset fields on my db?
Printable View
How to make the itemdata of combobox as the recordset fields on my db?
You could set the contents of a field as a Itemdata (providing the contents were numeric), but I dont think you can set it to the field itself.
yes thats I want. the contents of the field as an itemdata on my combobox. so that i can view the contents when I press the drop down arrow.
You cannot view the ItemData of a combo, it is purely a hidden property. I presume therefore that you want to add the contents of your recordset to the list.
You can do that like this (assuming your recordset already has the data, and the field to display is the first field):
(just change rs to the name of your recordset)VB Code:
Combo1.Clear Do While Not(rs.EOF) Combo1.Additem rs.fields(0) rs.MoveNext Loop