Form fields

N

Nick Pedder

Hi,

I am designing a form which requires users to select an option out of 45 categories. Unfortunately, word has a limit and will not add these all on.

These categories are divided into 7 divisions - would it be possible for the user to first select the division and in the next field select the relevant category within this division?

Any help would be greatly appreciated - I hope this makes sense !

Thanks,

Nick
 
C

Chad DeMeyer

Sure. Create two different dropdown formfields. In the first, manually add
all 7 categories as options. In the formfield options dialog, assign a name
like "Categories" to the first dropdown and "CategoryItems" to the second.
Write a macro along the lines of:

Sub SetCategoryItems()
Dim oCatFld As FormField
Dim oItmFld As FormField
Set oCatFld = ActiveDocument.FormFields("Categories")
Set oItmFld = ActiveDocument.FormFields("CategoryItems")
oItmFld.DropDown.ListEntries.Clear
Select Case oCatFld.Result
Case "Cats"
With oItmFld.DropDown.ListEntries
.Add "Siamese"
.Add "Persian"
... 'Add as many choices as needed
End With
Case "Dogs"
With oItmFld.DropDown.ListEntries
.Add "German Shepherd"
.Add "Dachsund"
... 'Add as many choices as needed
Case ... 'Add as many cases as needed, corresponding to the
options in your first dropdown
End Select
Set oItmFld = Nothing
Set oCatFld = Nothing
End Sub

Then assign this as the exit macro for the first dropdown. Voila!

Regards,
Chad DeMeyer



Nick Pedder said:
Hi,

I am designing a form which requires users to select an option out of 45
categories. Unfortunately, word has a limit and will not add these all on.
These categories are divided into 7 divisions - would it be possible for
the user to first select the division and in the next field select the
relevant category within this division?
 

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

Top