PDA

View Full Version : cascading drop down boxes: the sequel!



Fumer Tue
01-29-2011, 12:41 PM
Hi,
I've got one set of cascading drop downs working brilliantly, filling up a table.

However I require several copies of the same set on the same document.

So I duplicated the code for set 1 onto a new module, changing the bookmark and references, and everything works fine until you click outside the table, at which point all entries in both tables get cleared. It's obviously something to do with the macro attached to the primary drop downs, but ...

Here's the code I borrowed from Greg's site:

Sub OnExitDDListA()
Dim oDD As DropDown


Set oDD = ActiveDocument.FormFields("DD2").DropDown

'Clear previous list
oDD.ListEntries.Clear
'Repopulate list based on user selection
Select Case ActiveDocument.FormFields("PrimaryDD2").Result
Case "A"
With oDD.ListEntries
.Add "Apples"
.Add "Apricots"
.Add "Artichokes"
End With
Case "B"
With oDD.ListEntries
.Add "Blueberries"
.Add "Beets"
.Add "Brocolli"
End With
Case "C"
With oDD.ListEntries
.Add "Cherries"
.Add "Celery"
.Add "Cilantro"
End With
End Select
End Sub


Is there something I could add to stop this from happening?