Drop Down Choices

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

If I create a drop down box is there any way for the chosen answer to affect what choices are given in the next drop down box?
Example: Question 1, What is your favorite color? Choices: Red, Blue, Green are the choices.
Question 2, What is your favorite car. If red was chosen in Question 1 then the choices for question 2 are mustang, thunderbird. If green was chosen in question 1, then the choices for question 2 are minivan and corolla.

THANKS!!!!
 
Hi Pat

Yes, there is a way, but it requires a macro. Before anyone can tell you how
to write the macro, we need to know whether the dropdowns are from the Forms
toolbar or the Control Toolbox toolbar. Is this going to be a protected
form, where you can only type in the form fields, or does the rest of the
document have to be editable as well?
 
Since you're using form fields, this should work. It isn't a complete
solution, because just passing through the first dropdown without changing
its value still causes the second dropdown to be recalculated and lose its
previous value. Fixing that will take some more macro magic...

I chose the fictitious names ddcolor and ddcar for the two dropdown form
fields. The first one should have the colors permanently added to its list
through the Properties dialog, and the Calculate On Exit box must be
checked. Add the macro to the template, go back into the Properties dialog
of the colors dropdown, and select the macro as the exit macro.

Sub ExitDDcolor()
Dim userColor As String
Dim carField As FormField

On Error GoTo bye

Set carField = ActiveDocument.FormFields("ddcar")

' remove previous entries
carField.DropDown.ListEntries.Clear

' get value of first dropdown
userColor = LCase(ActiveDocument.FormFields("ddcolor").Result)

' set up second dropdown
Select Case userColor
Case "red"
carField.DropDown.ListEntries.Add "mustang"
carField.DropDown.ListEntries.Add "thunderbird"
Case "green"
carField.DropDown.ListEntries.Add "minivan"
carField.DropDown.ListEntries.Add "corolla"
Case Else
End Select
bye:
End Sub
 
Normally this type of checking or if answer is not right choice get a message must be done in access. Or use access in word. A Table is used for error checking or basic where you better know how to write SQL language checking
 

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

Back
Top