Ark68
Well-known Member
- Joined
- Mar 23, 2004
- Messages
- 4,564
- Office Version
- 365
- 2016
- Platform
- Windows
With my user form, the user selects a value from the dropdown list of combobox 1.
Based on the value combobox 1 (CB1), combobox 2 (CB2) is given a list unique to the result of CB1. The user can then select an appropriate value from CB2.
If the user changes their mind, and selects a different value from CB1, that change will normally repopulate CB2 with an updated list based on that change in CB1.
However, there are times when a user selects a value from CB1, and instead on CB2 being assigned a list, just a simple default value is sent to the control CB2. This normally isn't an issue. However, consider this scenario:
User selects COW form CB1. That in turn assigns CB2 a list of "Guernsey, Jersey, Holstein, Brown, Dairy,". The user can select from this list in CB2.
User selects COW from CB1, but changes their mind before selecting from CB2 (which has the appropriate list assigned to it). They select CHICKEN from CB1.
There is no list for CB2 associated with the selection of CHICKEN in CB1. Rather, just a single default value ... Silkie. So, rather than the user havingto select from a list of 1, the code automatically populates the CB2 control with silkie. combobox1.value="Silkie".
But this results in an error "Could not set the value property. Invalid property value."
I assume this error is a result of the list from the original selection from CB1 (COW) still residing in CB2? That original list consists of Guernsey, Jersey, Holstein, Brown, Dairy. The error comes from the fact that Silkie isn't in the list of available selections, so its not a value CB2 will accept.
My question ... how do I get rid of the list in CB2 when the user makes a different selection from CB1?
Based on the value combobox 1 (CB1), combobox 2 (CB2) is given a list unique to the result of CB1. The user can then select an appropriate value from CB2.
If the user changes their mind, and selects a different value from CB1, that change will normally repopulate CB2 with an updated list based on that change in CB1.
However, there are times when a user selects a value from CB1, and instead on CB2 being assigned a list, just a simple default value is sent to the control CB2. This normally isn't an issue. However, consider this scenario:
User selects COW form CB1. That in turn assigns CB2 a list of "Guernsey, Jersey, Holstein, Brown, Dairy,". The user can select from this list in CB2.
User selects COW from CB1, but changes their mind before selecting from CB2 (which has the appropriate list assigned to it). They select CHICKEN from CB1.
There is no list for CB2 associated with the selection of CHICKEN in CB1. Rather, just a single default value ... Silkie. So, rather than the user havingto select from a list of 1, the code automatically populates the CB2 control with silkie. combobox1.value="Silkie".
But this results in an error "Could not set the value property. Invalid property value."
I assume this error is a result of the list from the original selection from CB1 (COW) still residing in CB2? That original list consists of Guernsey, Jersey, Holstein, Brown, Dairy. The error comes from the fact that Silkie isn't in the list of available selections, so its not a value CB2 will accept.
My question ... how do I get rid of the list in CB2 when the user makes a different selection from CB1?