I have two combobox fields with the second combobox (Department) dependent on the first combobox (Ministry). If the value of the first combobox changes the options in the second combobox should change as well. I have used an
. What this does is, when I select value for first field then second combobox updates well, but when I try to change value for first combobox without closing the form, combobox2 shows options of chosen combobox1 value and those of the option that I had chosen before. The values I cached. So am wondering if I am using the correct statement or there is a way to modify my code.
Example code:
Code:
If combobox1.value change Then combobox2.Additem "values"
Example code:
Code:
If Not IsNull(Me.Ministry) And Ministry.Value = "PAT" Then Department.AddItem "xyzs" Department.AddItem "sxcty" End If If Not IsNull(Me.Ministry) And Ministry.Value = "MSP" Then Department.AddItem "bps" Department.AddItem "dce" Department.AddItem "dps" Department.AddItem "gic" Department.AddItem "nac" Department.AddItem "ofp" Department.AddItem "oop" Department.AddItem "ste" End If
Comment