Solved
Forum Discussion
DCat1223
10 years agoFrequent Contributor
Hi Tanya... Thank you for your help. I'm getting closer.
Regardless of the department I select in the dropdown, all warehouses display. Code and screenshot attached.
Again, what am I missing here? Unfortunately I'm not a developer so coding is trial and error for me. I suspect the issue lies in the IF statement but I'm certain.
Again, thank you so much for your assistance.
TanyaYatskovska
Alumni
10 years agoAdd the Clear method at the beginning of the OnChange event handler to clear the list of Warehouse combobox. Here is my code:
function UserForm1_cxComboBox2_OnChange(Sender) { UserForms.UserForm1.cxComboBox1.Properties.Items.Clear(); if (UserForms.UserForm1.cxComboBox2.Text == "Frozen") { with (UserForms.UserForm1.cxComboBox1.Properties.Items) { Add("100-Warehouse 100"); Add("200-Warehouse 200"); } } if (UserForms.UserForm1.cxComboBox2.Text == "Dairy") { with (UserForms.UserForm1.cxComboBox1.Properties.Items) { Add("110-Warehouse 110"); Add("210-Warehouse 210"); } } }
Does it help?