PDA

View Full Version : Conditional Dropdown entires



danield
05-09-2012, 08:09 AM
:banghead:
Okay I am trying to use a group of check boxes, to populate the options in a dropdown box.

First choice will be USDA or FHA, as I said, placed in check boxes. Based on that selection, I want a secondary dropdown box to be populated with options. If USDA is selected one set of options will display but if FHA is selected a different set of options will populate.

I am almost certain this can be done, though I've never seen it in a word doc before.

Screen shots are here: racmtg.com/test/screenshot.html

gmaxey
05-09-2012, 11:56 AM
It will help if you identify what type of check boxes and dropdowns. Are you dealing with a userform, content contorls or legacy formfields?

Since content controls and formfields don't have "change" events you will have to use the "Exit" events for your code. Something similiar is illustrated here:

http://gregmaxey.mvps.org/word_tip_pages/linked_formfield_dropdown_lists.html

You would basically replace the primary dropdown with a checkbox.

danield
05-09-2012, 02:31 PM
That link you provided was my solution thank you. It doesn't seem to be populating the secondary DD until I actually click it to make my selection, but it will work. For now if you make a Primary selection then make a Secondary selection, then go back and change the primary it will keep the secondary choices until you actually click on it again. It is changing the DD options it is just not registering that they are changed until you click on the secondary DD to select an option.

danield
05-09-2012, 02:32 PM
Sub OnExitDDListA()
Dim oDD As DropDown
Set oDD = ActiveDocument.FormFields("Dropdown2").DropDown
'Clear previous list
oDD.ListEntries.Clear
'Repopulate list based on user selection
Select Case ActiveDocument.FormFields("DropDown1").Result
Case "USDA"
With oDD.ListEntries
.Add "Purchase – Standard"
.Add "Purchase – Repair Escrow – add $450 if > $2,500"
.Add "Refinance – Streamline Pilot State Eligible"
.Add "Refinance – Streamline – Non-Pilot State"
.Add "Refinance – Full Appraisal – Include closing costs"
End With
Case "FHA"
With oDD.ListEntries
.Add "FHA Standard"
.Add "FHA 203B"
End With
End Select
lbl_Exit:
Exit Sub
End Sub