Follow up: Make a combo box dependant on another

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
 
S

Sue Mosher [MVP]

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.
 
A

Amy Brooks

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?
 
A

Amy Brooks

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top