1. Could you please (I know it takes a little time and effort) remove the spaces from the code, so it lines up a bit better. It is hard to read. For example.
Your post:
Code:
Select Case ActiveDocument.FormFields("Dropdown2").DropDown.Value
Case 1
ActiveDocument.FormFields("Result2").DropDown.ListEntries.Clear
For var = 1 To 4
ActiveDocument.FormFields("Result2").DropDown.ListEntries.Add Name:=Numerics(i)
i = i + 1
Next
ActiveDocument.FormFields("Result2").DropDown.Value = 1
Cleaned up:
Code:
Select Case ActiveDocument.FormFields("Dropdown2").DropDown.Value
Case 1
ActiveDocument.FormFields("Result2").DropDown.ListEntries.Clear
For var = 1 To 4
ActiveDocument.FormFields("Result2").DropDown_
.ListEntries.Add Name:=Numerics(i)
i = i + 1
Next
ActiveDocument.FormFields("Result2").DropDown_
.Value = 1
2. Please remove any code that is not really relevant.
3. You mention an error. When ever you get an error, it is very helpful for us to know what the error IS.
4. Use pusedo code.
OK. I am trying to understand what is happening.
I get the error when I change the selections of the dropdowns more than once and only if I change them to the same "selection" at one time and back. My real issue is getting all four sets of dropdowns working off of the same set of cases.
You have 6 formfields - lets call then DD1, DD2, DD3 ....
If I read it correctly, you have TWO conditional logic processes. You are picking up the Value results from Dropdown1, and Dropdown2.
Lets walk through some.
Code:
Case 3
ActiveDocument.FormFields("Result").DropDown.ListEntries.Clear
For var = 1 To 4
ActiveDocument.FormFields("Result").DropDown.ListEntries.Add Name:=Description(i)
i = i + 1
Next
ActiveDocument.FormFields("Result").DropDown.Value = 1
This is from the first Select Case. In this example, IF the resul;t of DropDown1 = 3, clear Result dropdown, add the list from the Description array, and make the value of Result dropdown = 1.
Tell me what is wrong. You make a selection in one dropdown, and it repopulates the .list in another. Are you asking if you can make make the REPOPULATED dropdown have a specific item showing at the top?
If so, please state this, because that is NOT the purpose of the code. The code POPULATES the other dropdowns. It has NO logic to determine WHICH item is at the top. The list is populated directly from the order in the arrays. You can populate by extended logic. This can be done, but you will have to figure out the logic for it. You have no logic for this. If this is what you are trying to do, post back, and I will help you out.
Gerry
See my
Paintings and Sculpture