D
dattagal
Hi All
I am new to this discussion group - thanks for providing it.
I have a situation similar to another user who wanted to programmatically
populate a dropdown based on the results of the previous dropdown. The user
was provided the following code:
Sub PopulateSubCat()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("Cat").Result
Case Is = "A"
With oFld("SubCat").DropDown
.ListEntries.Clear
.ListEntries.Add "Apples"
.ListEntries.Add "Apricots"
.Value = 1
End With
Case Is = "B"
With oFld("SubCat").DropDown
.ListEntries.Clear
.ListEntries.Add "Blueberries"
.ListEntries.Add "Bananas"
.Value = 1
End With
Case Is = "C"
'Etc.
End Select
End Sub
My situation is somewhat different however in that I need to
programmatically populate the first dropdown as well.
The first dd I need to populate is for group offices. Word limits the
entries in a dropdown (as I am sure you well know) to 25 and there are approx
30 group offices.
The second dropdown I want to populate is sales reps and I want to populate
the dd based on the selection in the group office dd. I also have a third dd
which will be account assistants which I would like populated based on the
group office selection as well.
For example, if the user selects Atalnta from the (programmatically
populated) Group Office dd, I want the Sales Rep dd and Account Assistants
dropdowns to populate with sales reps and account assistants in the Atanta
Group Office.
Also, I have a Cost Center field I would like to have populated with the
cost center of the group office selected in the first dropdown).
In other words, on selection of the group office I want the sales reps for
that group office to display in the Sales Reps dd, account assistants for
that group office to display in the Account Assistants dropdown and the cost
center for that group to appear in the Cost Center field.
Is it going to take a ton of code to accomplish this? Not that mind a
little work mind you and I love VBA (although I have never used it in Word)
but I am a little intimitated b/c my experience with VBA is in Access and
somewhat limited in that I use basically the same code over and over again in
different scenarios.
Anyway, any help with this woud be greatly appreciated.
Oh, sorry for the long post - I just wanted to make sure I was clear on what
I want to do.
btw: I believe it is Office 2000 I am using at work (I just started 3 weeks
ago so I am not 100% sure but I believe it is 2k)
Thanks so much
Dattagal
I am new to this discussion group - thanks for providing it.
I have a situation similar to another user who wanted to programmatically
populate a dropdown based on the results of the previous dropdown. The user
was provided the following code:
Sub PopulateSubCat()
Dim oFld As FormFields
Set oFld = ActiveDocument.FormFields
Select Case oFld("Cat").Result
Case Is = "A"
With oFld("SubCat").DropDown
.ListEntries.Clear
.ListEntries.Add "Apples"
.ListEntries.Add "Apricots"
.Value = 1
End With
Case Is = "B"
With oFld("SubCat").DropDown
.ListEntries.Clear
.ListEntries.Add "Blueberries"
.ListEntries.Add "Bananas"
.Value = 1
End With
Case Is = "C"
'Etc.
End Select
End Sub
My situation is somewhat different however in that I need to
programmatically populate the first dropdown as well.
The first dd I need to populate is for group offices. Word limits the
entries in a dropdown (as I am sure you well know) to 25 and there are approx
30 group offices.
The second dropdown I want to populate is sales reps and I want to populate
the dd based on the selection in the group office dd. I also have a third dd
which will be account assistants which I would like populated based on the
group office selection as well.
For example, if the user selects Atalnta from the (programmatically
populated) Group Office dd, I want the Sales Rep dd and Account Assistants
dropdowns to populate with sales reps and account assistants in the Atanta
Group Office.
Also, I have a Cost Center field I would like to have populated with the
cost center of the group office selected in the first dropdown).
In other words, on selection of the group office I want the sales reps for
that group office to display in the Sales Reps dd, account assistants for
that group office to display in the Account Assistants dropdown and the cost
center for that group to appear in the Cost Center field.
Is it going to take a ton of code to accomplish this? Not that mind a
little work mind you and I love VBA (although I have never used it in Word)
but I am a little intimitated b/c my experience with VBA is in Access and
somewhat limited in that I use basically the same code over and over again in
different scenarios.
Anyway, any help with this woud be greatly appreciated.
Oh, sorry for the long post - I just wanted to make sure I was clear on what
I want to do.
btw: I believe it is Office 2000 I am using at work (I just started 3 weeks
ago so I am not 100% sure but I believe it is 2k)
Thanks so much
Dattagal