View Full Version : How to add key/value pair to Combo Box in VBA.


kosala
05-27-2008, 07:35 AM
How to add key/value pair to Combo Box in VBA.

I have two Combo Boxes. First Combo Box will fill values into the Second Combo box. The key/ID of the selected value of the second Combo Box must bind to a field of Table.

I coudnt give the key/value pair using the ComboBox.Add(string,index) command. I need to do this with the ValueList property not with the Table/Query property.

Using the Table/Query property i could do this but it shows the Key/ID in the second ComboBox not the Value/Text in the Form Load and gives some unusual behaviours in the combobox when i tried to navigate through the records in the form as well.

Pat Hartman
05-28-2008, 11:13 AM
Search for topics on Cascading Combos. They will talk about how to use one combo to control the contents of a second. The methods rely on tables. They do not update the RowSource of the child combo.