Log in

View Full Version : Solved: Automatically select option in dropdown formfield



clhare
03-07-2008, 12:38 PM
I have a document with a couple formfield dropdown boxes in them. How would I automatically select an option in the second dropdown if a particular option in the first one is selected?

Tinbendr
03-08-2008, 12:48 PM
See Cascading ListBoxes (http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm) at Greg Maxey's site.

fumei
03-12-2008, 01:05 PM
Tinbendr, you seem to have a thing for userforms. The OP is not asking about userform controls.

Cheryl, use an OnExit macro for the first formfield to select the result of the second. Something like:
Dim DocFF As FormFields
Dim oFF As FormField
Set DocFF = ActiveDocument.FormFields
Set oFF = DocFF("Dropdown2")
Select Case DocFF("Dropdown1").Result
Case " one "
oFF.Result = oFF.DropDown.ListEntries.Item(1).Name
Case " two "
oFF.Result = oFF.DropDown.ListEntries.Item(2).Name
Case " three "
oFF.Result = oFF.DropDown.ListEntries.Item(3).Name
End Select

Small demo attached.

clhare
03-18-2008, 08:00 AM
This is a big help. Thank you so much!