Follow up: Make a combo box dependant on another

  • Thread starter Thread starter Amy Brooks
  • Start date Start date
A

Amy Brooks

Hi Sue,

Regarding the previous question, could I add more code to have a third combo
box relate to the second?

Thanks,
Amy
 
Again, that's going to depend on whether the 2nd combo box is bound or not.
If it is, you add another Case block to the CustomPropertyChange event
handler to handle the change in that property. If not, you use the control's
Click event. See the previously suggested article.
 
Bound is when it saves the selections when closed?
If so, I think they are bound.
If they are, how would I go about adding another case block? There are more
values now, is that still the way to go?
 
So maybe something like:

-----------------------------------------------------------------------------------------------
Sub Item_CustomPropertyChange(ByVal Name)
Select Case Name
Case "Division"
Call SetSubDivision
Case "SubDivision"
Call SetThirdBox
End Select
End Sub
_________________________________________________

Sub SetSubDivision
Set objInsp = Item.GetInspector
Set objPage = objInsp.ModifiedFormPages("General")
Set SubDivision = objPage.Controls("cboSubDivision")
Select Case Item.UserProperties("Division")
Case "Ambulance"
SubDivision.List = Split("Air,NHS,Private,Vehicle Builder,Voluntary",",")
Case "Export"
SubDivision.List = Split("Distributor,End User,Ferno Group",",")
Case "Hospital"
SubDivision.List = Split("Distributor,MOD,NHS,Private",",")
Case "Industry"
SubDivision.List = Split("N/A",",")
Case "Mortuary"
SubDivision.List = Split("Distributor,Funeral Director",",")
End Select
End Sub
_________________________________________________

Sub SetThirdBox
Set objInsp = Item.GetInspector
Set objPage = objInsp.ModifiedFormPages("General")
Set ThirdBox = objPage.Controls("cboThirdBox")
Select Case Item.UserProperties("SubDivision")
Case "NHS"
ThirdBox.List = Split("Option A, Option B",",")
Case "Private"
ThirdBox.List = Split("Option C, Option D",",")
(etc.....)
End Select
End Sub
 
Back
Top