Outlook Banter

Outlook Banter (http://www.outlookbanter.com/)
-   Outlook and VBA (http://www.outlookbanter.com/outlook-vba/)
-   -   Make a combo box dependant on another (http://www.outlookbanter.com/outlook-vba/91068-make-combo-box-dependant-another.html)

Amy Brooks June 2nd 09 12:02 PM

Make a combo box dependant on another
 
Hi,

I have two combo boxes, one named Division, the other named Sub-Division.
I want to make it so that if you select (for example) Ambulance from the
Division list, the Sub-Division list will only show related items, like NHS,
Private, Air. The lists are as follows:

Ambulance
Air
NHS
Private
Voluntary
Vehicle Builder
Export
Distributor
End User
Group
Hospital
NHS
Private
Distributor
Industry
N/A
Mortuary
Distributor
Funeral Director

The code I have so far is:
------------------------------------------------------------------------------------------------
Sub Item_CustomPropertyChange(ByVal Name)
Select Case Name
Case "cboDivision"
Call SetSubDivision
End Select
End Sub
_____________________________________________

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

I'm not sure if this is correct, or where to put it.
Help would be appreciated!

Thanks,
Amy


All times are GMT +1. The time now is 02:43 PM.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 2.4.0
Copyright ©2004-2006 OutlookBanter.com